Solved

select within exec

Posted on 2010-08-23
7
355 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
How our DevOps Teams Maximize Uptime

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us. Read the use case whitepaper.

 
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

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Remove () 10 42
mysql workbecn having problems to export tables to cvs 4 28
SQL Server Pivot 5 44
Sql Function to get the word position 20 17
I'm trying, I really am. But I've seen so many wrong approaches involving date(time) boundaries I despair about my inability to explain it. I've seen quite a few recently that define a non-leap year as 364 days, or 366 days and the list goes on. …
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
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…

752 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