Executing a SQL Script

B

Bruce Hodge

Hi All,

We've got some complex configuration scripts that we need to run against a
S2K database, they configure our application. For a number of reasons we
want to run them from within .Net. At the moment we Open the file from C#
read in the text to a string variable and then pass it to SQL for
processing. A typical file would be

Declare @AccountID

Select @AccountID = AccountID
From TAccounts
Where [Name] = 'Test Account'

Exec add_config_data @AccountID = @AccountID, @Code='TT',
@Description='TestCode'
Exec add_config_data @AccountID = @AccountID, @Code='TT2',
@Description='TestCode2'

The problem we have is how to run this script using ADO.Net. For other
scripts such as Table Update files we've been able to split the string into
executable chunks then exec them using a Command object, but that won't work
for above. Thoughts/Help appreciated.

Regards


Bruce H
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top