Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 365
  • Last Modified:

select within exec

is itpossible to hold a select statement within an exec statement, in some other way?

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

thanks
0
anushahanna
Asked:
anushahanna
3 Solutions
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
no, that is not possible like this.
I presume you want to "exec" for each row of what is returned?

please clarify
0
 
kingjelyCommented:
SET @dateski := (select curdate())

Im awsm(not).
Kj
0
 
anushahannaAuthor Commented:
I am thinking of appending the current time to a variable string.
0
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
Om PrakashCommented:
Try:

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

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

print @mystring  
0
 
anushahannaAuthor Commented:
Thanks.
0
 
kingjelyCommented:


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

 ;)
0
 
kingjelyCommented:
its not possible gets points?
hehe love ur work
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now