Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Dynamically build sql script

Author  Topic 

AskSQLTeam
Ask SQLTeam Question

0 Posts

Posted - 2004-09-09 : 08:29:35
Chandrasekhar writes "My task includes to generate sql scripts of tables, procedures through vb.
How can we generate sql server scripts of tables through vb.
Also I have to run the scripts from vb so as to create new tables and sp's."

JimL
SQL Slinging Yak Ranger

1537 Posts

Posted - 2004-09-09 : 08:46:30
Just curious, Why must it be though VB?

Jim
Users <> Logic
Go to Top of Page

AndrewMurphy
Master Smack Fu Yak Hacker

2916 Posts

Posted - 2004-09-09 : 08:54:36
search here for DMO....i think "nr"...may already have posted a solution that you can use/adapt.
Go to Top of Page

n/a
deleted

35 Posts

Posted - 2004-09-09 : 13:06:02
just create a string variable in vb and put your script in that

dim sSQL as string
ssql = "create table tablename (col1 varchar, col2 int)"

then execute your sql script throught your vb connectoin to SQL

vbconnection.execute (sSQL)

the syntax on the execute will vary based on the provider and connection you are using.

HTH
Paul
Go to Top of Page
   

- Advertisement -