Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Shaun E on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Creating Multiple Views

Status
Not open for further replies.

NeilV

Programmer
Oct 14, 2002
117
GB
Hello,

I am trying to create 2 views in my SQL Server database using 1 statement eg:
create view View1 as select partnumber from Table1
Go
create view View2 as select * from table2

This works fins under SQL query analyser, but if i try to run it from code it gives the following error:
Incorrect syntax near 'GO'. 'CREATE VIEW' must be the first statement in a query batch

obviously it doesn't like the "go" keyword and removing this still causes an error. I can run 2 seperate statements but I would like to run it in one go if possible.

Anyone have any ideas?

Neil
 
I've not tested it, but using a semi-colon to delimit the two statements may work.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top