Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Transfer coding in MS SQL
Message
From
13/10/2004 05:52:18
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
Other
Title:
Transfer coding in MS SQL
Miscellaneous
Thread ID:
00950958
Message ID:
00950958
Views:
55
Hi everyone,

I need to transfer my system from using .dbf file replace to MS SQL,

And i have start to learn coding with MS SQL as below:

CON = SQLSTRINGCONNECT("MYSERVER")

IF CON>0
? "OK"
ELSE
? "ERROR"
ENDIF

= SQLEXEC( CON, "CREATE DATABASE MYDATABASE;")
= SQLEXEC( CON, "USE MYDATABASE;")
= SQLEXEC( CON, "CREATE TABLE CUSTOMER (CID INT(10), CNAME VARCHAR(20);")
= SQLEXEC( CON, "INSERT INTO CUSTOMER (CID,CNAME) VALUES 123,'ABC';")
= SQLEXEC( CON, "SELECT * FROM CUSTOMER","TEMP")

The above were what i learn today.

And, now i back to my old system, can you tell me how to change the code to SQL


==========
QUESTION 1
*****
USE C:\CUSTOMER ALIAS CUS
=CURSORSETPROP("BUFFERING",5)
NEWNO = "IBM"

DO !FLOCK()
ENDDO

APPE BLANK
REPL CUS_NO WITH NEWNO
UNLOCK

SCAT MEMV MEMO
M.CUS_NAME = "IBM COMPANY"
GATH MEMV MEMO

DO WHILE !TABLEUPDATE(.T.,.T.)
ENDDO

* OR
* =TABLEREVERT(.T.,"CUS")
USE


==========
QUESTION 2
In my old system i can use INDEX ON SUBS(CUS_NO,1,3) + STR(CUS_YEAR) TAG CUSSEQ
do i need to add one more field inside the SQL-file as below:
***
CUS_NO = "IBM "
CUS_YEAR = 2004
CUS_NY = "IBM 2004" <= new field for sort
***
Then call it with SELECT * FROM CUSTOMER WHERE CUS_NY = 'IBM 2004';
Is't correct ?


==========
QUESTION 3
How can i get the number of record from SQLEXEC command, ( i don't want to give all into a TEMP file then use RECC() )


==========
QUESTION 4
My database as below :

PROD_ID , PROD_NO , PROD_NAME
---------------------
11 , I008 , ICE-CREAM LEMON
43 , I009 , ICE-CREAM APPLE
22 , H013 , HOT LEMON TEA
38 , H014 , HOT TEA

Now i want to add a new product with begining number "I", how to do that ?
** how to know the next number is I010 **
Next
Reply
Map
View

Click here to load this message in the networking platform