Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

output variable value?

Posted on 2012-12-27
3
Medium Priority
?
226 Views
Last Modified: 2012-12-27
nothing outputs:

SELECT @Abbr = RTRIM(Merchant.Abbr)
FROM Asset
INNER JOIN Pool ON Asset.PoolID = Pool.PoolID AND Asset.PoolSID = Pool.PoolSID
INNER JOIN Merchant on Pool.MerchantID = Merchant.MerchantID AND Pool.MerchantSID = Merchant.MerchantSID
WHERE Asset.AssetID = @AssetID AND Asset.AssetSID = @AssetSID

how do I see what is in @Abbr?
0
Comment
Question by:Tom Knowlton
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 38725399
That's because when you SET @variable = something, it makes the assignment but does not SELECT the value such that it is returned.

SELECT @Abbr = RTRIM(Merchant.Abbr)
FROM Asset
INNER JOIN Pool ON Asset.PoolID = Pool.PoolID AND Asset.PoolSID = Pool.PoolSID
INNER JOIN Merchant on Pool.MerchantID = Merchant.MerchantID AND Pool.MerchantSID = Merchant.MerchantSID
WHERE Asset.AssetID = @AssetID AND Asset.AssetSID = @AssetSID

-- Show the value
SELECT @Abbr
0
 
LVL 66

Accepted Solution

by:
Jim Horn earned 2000 total points
ID: 38725408
... or, not even have the @Abbr variable, and just return the value, like ...


SELECT RTRIM(Merchant.Abbr)
FROM Asset
INNER JOIN Pool ON Asset.PoolID = Pool.PoolID AND Asset.PoolSID = Pool.PoolSID
INNER JOIN Merchant on Pool.MerchantID = Merchant.MerchantID AND Pool.MerchantSID = Merchant.MerchantSID
WHERE Asset.AssetID = @AssetID AND Asset.AssetSID = @AssetSID
0
 
LVL 5

Author Closing Comment

by:Tom Knowlton
ID: 38725548
thx
0

Featured Post

What is SQL Server and how does it work?

The purpose of this paper is to provide you background on SQL Server. It’s your self-study guide for learning fundamentals. It includes both the history of SQL and its technical basics. Concepts and definitions will form the solid foundation of your future DBA expertise.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this video, Percona Director of Solution Engineering Jon Tobin discusses the function and features of Percona Server for MongoDB. How Percona can help Percona can help you determine if Percona Server for MongoDB is the right solution for …
In this video, Percona Solution Engineer Rick Golba discuss how (and why) you implement high availability in a database environment. To discuss how Percona Consulting can help with your design and architecture needs for your database and infrastr…

618 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question