We help IT Professionals succeed at work.

SQL Batch in ADO Command Object

eguru007
eguru007 asked
on
297 Views
Last Modified: 2008-03-17
I have a situation where multiple line of sql statements needs to be executed. The batch is seperated by GO words between statements and runs perfectly from query analyser. But I am unable to run this batch using one single command object from a VBScript file. I wonder if it is possible, if yes how.

PS: I don't have option of using stored procs

Here is the code:
CREATE TABLE #bcp_origional (ObjectName nvarchar(100), ObjectValue nvarchar(100))
GO
BULK INSERT #bcp_origional FROM 'C:\database_info.txt' with ( FieldTerminator = ':')
Go
CREATE TABLE #bcp_temp_copymaster (ObjectName nvarchar(100), ObjectValue nvarchar(100))
GO
INSERT INTO #bcp_temp_copymaster SELECT * FROM #bcp_origional
GO
DELETE #bcp_temp_copymaster FROM (SELECT TOP 10 * FROM #bcp_temp_copymaster)AS t1
WHERE #bcp_temp_copymaster.ObjectName = t1.ObjectName
GO
SELECT * FROM #bcp_temp_copymaster WHERE ObjectName in (SELECT name FROM dec03l1..sysobjects WHERE type='u'
Comment
Watch Question

CERTIFIED EXPERT
Commented:
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
CERTIFIED EXPERT

Commented:
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.