Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

= SQLEXEC(Conn1, "ALTER TABLE TBLAGENTS ADD COLUMN RECNUM C(10)") 2

Status
Not open for further replies.

Ahmad kaj

Programmer
Apr 29, 2022
11
0
1
NG

= SQLEXEC(Conn1, "ALTER TABLE TBLAGENTS ADD COLUMN RECNUM C(10)")

it not accepting the c(10) instead i have to type char(10) before it works and it is not accepting n(10)???
what are the correct variables representation in this case i know for now that c = char but for n =? and for date =? and why is so??
In The VFP8 Help file and in Microsoft SQL Programming Reference there is no indication for the <char> word instead <c> is used in the SQL Statement related to Create, ADD, Alter? Is There is a certain settings am missing?

A.o.Kaj
 
You're using SQLEXEC, whicch is part of the SQL passthrough functions. Passthrough means you pass commands/queries/etc. to a remote database server. You have to use its SQL dialect.
For example, if you're connecting to MS SQL Server, this is documented in
C(10) and N(10) are FoxPro/VFP specific syntax. I don't know any other database using single letter data types. They all use the usual type names, and often also offer some tpes VFP does not know.
So, make yourself known to the database system you're using with the connection.

Chriss
 
I agree. In general, when using SQLEXEC(), you have to use the syntax of the back-end database.

And it follows that, in order for us to answer this type of question, we have to know which back-end database you are using. There are many such databases in existence, and although the majority use a fairly standard syntax, there are many exceptions, especially regarding data types.

However, given that you mentioned the Microsoft reference manual, I will assume that you are using Microsoft's SQL Server as your back end. If so, you will probably use [tt]char(10)[/tt] rather than [tt]C(10[/tt]) to specify the data type. I say "probably" because there are other character dataypes as well, including [tt]varchar[/tt], [tt]nchar[/tt] and [tt]nvarchar[/tt].

I suggest that before going any further, you spend some time learning the basics of SQL Server syntax (the particular dialect is called T-SQL). You can't do any serious SQL development work without that knowledge, however well you know VFP.

Mike

__________________________________
Mike Lewis (Edinburgh, Scotland)

Visual FoxPro articles, tips and downloads
 
Thank you. i got it.
highly appreciated.

Ahmad.
 
Watch out for how to translate FoxPro types to types of the remote database...

In Foxpro, numeric fields N(n,d) compare to T-SQL numeric(p,s). But the meanings of (n,d) (FoxPro) and (p,s) (T-SQL) are very different, so the translation isn't simply to turn N into NUMERIC.
And it will be different with other database systems, again.

Here's the reference roof topic about data types: If you use something else, well, you'll usually also find an online reference of course.

Chriss
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top