Solved

SQL statement completion

Posted on 2007-03-21
2
239 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

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…
I am showing a way to read/import the excel data in table using SQL server 2005... Suppose there is an Excel file "Book1" at location "C:\temp" with column "First Name" and "Last Name". Now to import this Excel data into the table, we will use…
This Micro Tutorial will give you a basic overview how to record your screen with Microsoft Expression Encoder. This program is still free and open for the public to download. This will be demonstrated using Microsoft Expression Encoder 4.
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…

772 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