Solved

SQL statement completion

Posted on 2007-03-21
2
228 Views
Last Modified: 2010-03-19
I have an SQL statement and am unsure how to declare two variables:

select @sitecode = ThisSiteCode, @siteid='ScopeId_'+substring(ThisSiteGuid, 2, 36) from SMSData

Can you give me a hand with how to declare @sitecode and @siteid?

Thanks!
JD
0
Comment
Question by:johndarby
2 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 500 total points
ID: 18766257
for example, like this:

declare @sitecode int
declare @siteid varchar(200)
select @sitecode = ThisSiteCode, @siteid='ScopeId_'+substring(ThisSiteGuid, 2, 36) from SMSData

note however, that only values of 1 row will be stored in the variables.
if you want more rows to be handled, you will need a different solution.

please explain in more details what you are trying to acheive
0
 
LVL 1

Author Comment

by:johndarby
ID: 18766324
That does it! Thanks!
0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
Sending a Secure fax is easy with eFax Corporate (http://www.enterprise.efax.com). First, just open a new email message. In the To field, type your recipient's fax number @efaxsend.com. You can even send a secure international fax — just include t…
As a trusted technology advisor to your customers you are likely getting the daily question of, ‘should I put this in the cloud?’ As customer demands for cloud services increases, companies will see a shift from traditional buying patterns to new…

920 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

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now