Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing Table structure
Message
 
À
03/04/2009 18:58:34
Hong Yew
People Quest
Malaisie
Information générale
Forum:
Visual FoxPro
Catégorie:
Client/serveur
Versions des environnements
Visual FoxPro:
VFP 9 SP2
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
MS SQL Server
Application:
Desktop
Divers
Thread ID:
01393201
Message ID:
01393697
Vues:
53
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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform