Click here to Skip to main content
15,895,808 members
Please Sign up or sign in to vote.
1.00/5 (2 votes)
See more:
wat does dis error mean.I have a procedure executing t-sql statement and when I execute the procedure I got this error.
I have a method being called in the select list I tried commenting it and executing but still I am getting the error.
My proc is some what like this.

SQL
create proc test
(
@a char(1),
@b char(1),
@c char(1)
)
as
declare @sql varchar(max)
set @sql='select p.col1,p.col2 from('
if(@a=1)
begin
set @sql+='select col1 ,col2 from a union '
end
if(@b=1)
begin
set @sql+='select col1 ,col2 from b union '
end
if(@c=1)
begin
set @sql+='select col1,col2 from c'
end
set @sql+=')p'
Posted
Updated 9-May-13 7:53am
v3
Comments
Sebastian T Xavier 9-May-13 2:19am    
Better format your code, and please don't use 'sms' language
Sebastian T Xavier 9-May-13 2:21am    
You can print the query and see what happens...
AmrutaKanvinde 9-May-13 2:35am    
Ya thanks i used CTE and am getting the result now
Maciej Los 15-May-13 14:39pm    
Share your solution and mark answer as "solved".
ZurdoDev 9-May-13 15:28pm    
Post as solution so this gets marked as Answered.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900