This is a discussion on Stored Proc to assign variable from subquery not working -- ugh within the SQL Server forums, part of the Microsoft SQL Server category; --> Hi, I'm trying to run a stored proc: ALTER PROCEDURE dbo.UpdateXmlWF ( @varWO varchar(50) ) AS DECLARE @varCust VARCHAR(50) ...
| |||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| ||||
| Hi, I'm trying to run a stored proc: ALTER PROCEDURE dbo.UpdateXmlWF ( @varWO varchar(50) ) AS DECLARE @varCust VARCHAR(50) SELECT @varCust=(SELECT Customer FROM tblWorkOrders WHERE WorkOrder=@varWO) When I remove the SELECT @varCust= I get the correct return. With it in, it just appears to run but nothing comes up in the output window. PLEASE tell me where I'm going wrong. I'm using MSDE, although I don't think that should matter? Thanks, Kathy |
| |||
| Kathy, I think you need this instead: SELECT @varcust = Customer FROM tblWorkOrders WHERE WorkOrder = @varWO -- -Chuck Urwiler, MCSD, MCDBA http://www.eps-software.com "KathyB" <KathyBurke40@attbi.com> wrote in message news:75e8d381.0310030635.753cd52a@posting.google.c om... > Hi, I'm trying to run a stored proc: > > ALTER PROCEDURE dbo.UpdateXmlWF > ( > @varWO varchar(50) > ) > AS > DECLARE @varCust VARCHAR(50) > > SELECT @varCust=(SELECT Customer FROM tblWorkOrders > WHERE WorkOrder=@varWO) > > When I remove the SELECT @varCust= I get the correct return. With it > in, it just appears to run but nothing comes up in the output window. > > PLEASE tell me where I'm going wrong. I'm using MSDE, although I don't > think that should matter? > > Thanks, Kathy |
| ||||
| Instead of "SELECT @varCust=" use "SET @varCust= " KathyBurke40@attbi.com (KathyB) wrote in message news:<75e8d381.0310030635.753cd52a@posting.google. com>... > Hi, I'm trying to run a stored proc: > > ALTER PROCEDURE dbo.UpdateXmlWF > ( > @varWO varchar(50) > ) > AS > DECLARE @varCust VARCHAR(50) > > SELECT @varCust=(SELECT Customer FROM tblWorkOrders > WHERE WorkOrder=@varWO) > > When I remove the SELECT @varCust= I get the correct return. With it > in, it just appears to run but nothing comes up in the output window. > > PLEASE tell me where I'm going wrong. I'm using MSDE, although I don't > think that should matter? > > Thanks, Kathy |