Solved

select within exec

Posted on 2010-08-23
7
340 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
VMware Disaster Recovery and Data Protection

In this expert guide, you’ll learn about the components of a Modern Data Center. You will use cases for the value-added capabilities of Veeam®, including combining backup and replication for VMware disaster recovery and using replication for data center migration.

 
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Linked Server Issue with SQL2012 3 26
SQL Server 2012 - Merge Replication Issue 1 22
Help creating a spatial object in SQL Server 4 23
SQL Count issue 24 16
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

810 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