Solved

SQL statement completion

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

Get up to 2TB FREE CLOUD per backup license!

An exclusive Black Friday offer just for Expert Exchange audience! Buy any of our top-rated backup solutions & get up to 2TB free cloud per system! Perform local & cloud backup in the same step, and restore instantly—anytime, anywhere. Grab this deal now before it disappears!

Join & Write a Comment

I've encountered valid database schemas that do not have a primary key.  For example, I use LogParser from Microsoft to push IIS logs into a SQL database table for processing and analysis.  However, occasionally due to user error or a scheduled task…
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
This video demonstrates how to create an example email signature rule for a department in a company using CodeTwo Exchange Rules. The signature will be inserted beneath users' latest emails in conversations and will be displayed in users' Sent Items…

757 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

20 Experts available now in Live!

Get 1:1 Help Now