June 22, 2008 at 11:19 am
I have a stored procedure that I need to convert into a view. This sp makes use of two table variables that it then draws the final results from. When I try to do this in the view I get the following error:
Incorrect syntax near the keyword 'DECLARE'
Can you not use table variables in a View? Is there another way to handle this sort of thing?
June 22, 2008 at 11:38 am
A View consists of a single Select statement, only.
You can often transform procedural code into a single Select in unobvious ways, but this is always very case-specific. So in order to give more specific pointers, we would need to see your code.
[font="Times New Roman"]-- RBarryYoung[/font], [font="Times New Roman"] (302)375-0451[/font] blog: MovingSQL.com, Twitter: @RBarryYoung[font="Arial Black"]
Proactive Performance Solutions, Inc. [/font][font="Verdana"] "Performance is our middle name."[/font]
June 22, 2008 at 12:29 pm
Why do you need the proc turned into a view?
Gail Shaw
Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability
June 22, 2008 at 2:05 pm
Save us all some time... post the stored procedure that you're trying to convert into a view.
--Jeff Moden
Change is inevitable... Change for the better is not.
June 23, 2008 at 4:34 am
I've convinced the powers-that-be that this isn't something worth exploring since the proc works fine as is. Thanks for all of your help.
June 25, 2008 at 12:57 pm
Hi,
Noramlly people convert he views to stored procedurs but here the case is bit opposite.
May i know what is it your trying to address?
Thanks -- Vj
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply