Solved

select within exec

Posted on 2010-08-23
7
359 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
[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
7 Comments
 
LVL 143

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
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Database Solutions Engineer FAQs

In this series, we will discuss common questions received as a database Solutions Engineer at Percona. In this role, we speak with a wide array of MySQL and MongoDB users responsible for both extremely large and complex environments to smaller single-server environments.

Question has a verified solution.

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

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.
I have a large data set and a SSIS package. How can I load this file in multi threading?
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

623 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