Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Changing Table structure
Message
 
To
03/04/2009 18:58:34
Hong Yew
People Quest
Malaysia
General information
Forum:
Visual FoxPro
Category:
Client/server
Environment versions
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Miscellaneous
Thread ID:
01393201
Message ID:
01393697
Views:
52
How about:
lcDbName    = [Test]         &&& your DB Name
lcTableName = [Table_1]      &&& Table Name
lcFieldName = [ExistsThisField]   &&& adding column if not exists
TEXT TO lcSql NOSHOW TEXTMERGE PRETEXT 15
     IF  NOT EXISTS(SELECT * FROM <<m.lcDbName >>.INFORMATION_SCHEMA.COLUMNS
                             WHERE table_name = '<<m.lcTableName>>' AND column_name = '<<m.lcFieldName>>')
         ALTER TABLE <<m.lcDbName >>.dbo.<<m.lcTableName>> ADD <<m.lcFieldName>> numeric(12, 2) NULL
ENDTEXT

lnResult = SQLEXEC(m.sqlhandler,m.lcSql)
IF m.lnResult < 0
   AERROR(err_array)
   MESSAGEBOX(err_array(1,2))
   * Process this error
ENDIF
>Hi all
>
>May I know how we can check a MSSQL table structure and modify the structure by adding a coulmn of a MSSQL table programmaticaly from a VFP app?
>
>Your advice much appreciated.
>
>Thankas and Best Regards
_______________________________________________________________
Testing displays the presence, not the absence of bugs.
If a software application has to be designed, it has to be designed correctly!
_______________________________________________________________
Vladimir Zografski
Systems Analyst
Previous
Reply
Map
View

Click here to load this message in the networking platform