Your issue is in bold
yanine (2/27/2008)
declare @representative varchar(255)set @representative= 'Victaulic'
exec ('
select me.Member_Id, UPPER(me.Member_Name)as Member_Name, me.Member_City, me.Member_State, me.Member_Fax
from members me, Manufacturers m, Manufacturers_Categories mc, Categories c, Representations r
where me.Member_Id = r.Member_Id
and m.Manufacturer_Id = r.Manufacturer_Id
and m.Manufacturer_Id = mc.Manufacturer_Id
AND c.Category_Id = mc.Category_Id
and me.Member_Name = '+char(39)+ @representative +char(39)+ '
group by me.Member_Id, me.Member_Name, me.Member_City, me.Member_State, me.Member_Fax')
Message Error:
Server: Msg 207, Level 16, State 3, Line 2
The column name 'Victaulic' is not valid.
I tryed moving the + signs but nothing seems to work, please help me out.
Greetings, Yanine
Render the Char(39) into the SQL string, not as part of the T-SQL itself.
----------------------------------------------------------------------------------
Your lack of planning does not constitute an emergency on my part...unless you're my manager...or a director and above...or a really loud-spoken end-user..All right - what was my emergency again?