Solved

select within exec

Posted on 2010-08-23
7
317 Views
Last Modified: 2012-05-10
is itpossible to hold a select statement within an exec statement, in some other way?

exec
(
select cast (getdate() as varchar(200))
)

thanks
0
Comment
Question by:anushahanna
7 Comments
 
LVL 142

Accepted Solution

by:
Guy Hengel [angelIII / a3] earned 167 total points
ID: 33500299
no, that is not possible like this.
I presume you want to "exec" for each row of what is returned?

please clarify
0
 
LVL 8

Assisted Solution

by:kingjely
kingjely earned 167 total points
ID: 33500317
SET @dateski := (select curdate())

Im awsm(not).
Kj
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33500318
I am thinking of appending the current time to a variable string.
0
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)

 
LVL 22

Assisted Solution

by:Om Prakash
Om Prakash earned 166 total points
ID: 33500344
Try:

declare @mystring varchar(200)
set @mystring  = 'test '

--append current time
select @mystring  = @mystring  + convert(varchar(10),getDate(),108)

print @mystring  
0
 
LVL 6

Author Comment

by:anushahanna
ID: 33500359
Thanks.
0
 
LVL 8

Expert Comment

by:kingjely
ID: 33500387


good get angelll, and om, give a new kid a break ay !

 ;)
0
 
LVL 8

Expert Comment

by:kingjely
ID: 33500417
its not possible gets points?
hehe love ur work
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

Suggested Solutions

Introduction In my previous article (http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SSIS/A_9150-Loading-XML-Using-SSIS.html) I showed you how the XML Source component can be used to load XML files into a SQL Server database, us…
Load balancing is the method of dividing the total amount of work performed by one computer between two or more computers. Its aim is to get more work done in the same amount of time, ensuring that all the users get served faster.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

708 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

15 Experts available now in Live!

Get 1:1 Help Now