Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL statement completion

Posted on 2007-03-21
2
Medium Priority
?
268 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
[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 Comments
 
LVL 143

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 2000 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

Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

Question has a verified solution.

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

If you having speed problem in loading SQL Server Management Studio, try to uncheck these options in your internet browser (IE -> Internet Options / Advanced / Security):    . Check for publisher's certificate revocation    . Check for server ce…
So every once in a while at work I am asked to export data from one table and insert it into another on a different server.  I hate doing this.  There's so many different tables and data types.  Some column data needs quoted and some doesn't.  What …
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…
Have you created a query with information for a calendar? ... and then, abra-cadabra, the calendar is done?! I am going to show you how to make that happen. Visualize your data!  ... really see it To use the code to create a calendar from a q…

704 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