![]() ![]() If you're doing it so you can query it a couple of times within the stored proc, then I'd think you'd be much better off inserting data into a table variable or temp table, and querying off of it.But then again, why not make the view a permanent object? dbo.dimDates')-Msg 102, Level 15, State 1, Line 1Incorrect syntax near 'go'.Msg 111, Level 15, State 1, Line 1'CREATE VIEW' must be the first statement in a query batch.-thank you Spirit, I get the following message when using:exec(' use go create view dimDates_1 as select * from. Ha,spirit,thats what ive been trying to do butwhen i use exec and preapend the name of the database I get the following message:"'CREATE/ALTER VIEW' does not allow specifying the database name as a prefix to the object name."the stored procedure generates dimension tables for further use in analysis server, some are viewsthank youĮxec(' use yourDBName go create view. dbo.myv1as.')But why you want to create view inside a stored proc?Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" ![]() Prefix view with db name.Exec('Create View. You can use dynamic sql and Exec()_Causing trouble since 1980blog: ![]() Hi, Im am wandering if it is possible to create two views in two different tables from within the same stored proc:excreate proc myProcasuse gocreate view myV1asselect * from mytablegouse gocreate view myV2asselect * from mytablegogo-of course the go's are not allowed in a sproc, the create statement must be the first of a query batch and a vew can not have the databaase name preapended like when creating a table plus one can not use the "use" word in a proc, I tried using exec to bypass the "first statement in a batch" and go restrictions but have not been able to overcome the "use " restriction, is there a way to solve this problem?thank you We've got lots of great SQL ServerĮxperts to answer whatever question you can come up with. ![]()
0 Comments
Leave a Reply. |