473,396 Members | 1,929 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Stored Proc to assign variable from subquery not working -- ugh

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
Jul 20 '05 #1
2 6797
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" <Ka**********@attbi.com> wrote in message
news:75**************************@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

Jul 20 '05 #2
Instead of "SELECT @varCust=" use "SET @varCust= "
Ka**********@attbi.com (KathyB) wrote in message news:<75**************************@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

Jul 20 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Jarrod Morrison | last post by:
Hi all Im relatively new to using stored procedures and im not sure if it is possible to do what I am trying to do so any help here is greatly appreciated. I am using the variable @MachineName...
2
by: dragonmsw | last post by:
I'm having a problem invoking DB2 Stored Procedures from REXX. I've written a generic SP tester where you enter the schema and name of the SP. The next panel displays the parms for the SP and...
1
by: Mark | last post by:
ASP.NET: Any suggestions on how to display an animated .gif file on a web page while a stored procedure is running in the background? For example, on some of the airline sites, it asks you to...
1
by: Eric Land | last post by:
Help! I'm trying to call a parameterized stored proc in ASP.NET in VB. I am creating a command object and creating a parametr list, and assigning a value from a session variable (this is working)...
45
by: John | last post by:
Hi When developing vb.bet winform apps bound to sql server datasource, is it preferable to use SELECTs or stored procedure to read and write data from/to SQL Server? Why? Thanks Regards
6
by: Paul M | last post by:
Hi All, I'm currently writing a z/OS DB2 Stored Proc in C, using an example from the IBM Stored Procedure guide (SG24-7083-00). The database calls to read and update the database work...
0
by: ravindrag | last post by:
Hi, I am getting error SQL1131N during sqlj.install_jar(...). There is no useful message in the diag.log (even with diag level 4). I am giving the diag.log entries at the end of this posting...
5
by: bbawa1 | last post by:
I have the following stroed procedue. But whebnnI execute it it gives me following errors. Could you please tell me what is wrong Msg 156, Level 15, State 1, Procedure usp_DateDiff, Line 43...
0
by: mirandacascade | last post by:
Questions toward the bottom of the post. Situation is this: 1) Access 97 2) SQL Server 2000 3) The Access app: a) sets up pass-thru query b) .SQL property of querydef is a string, the...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.