Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 print datetime

Author  Topic 

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2008-03-06 : 20:18:21
just wanted to get sql to stamp the date/time to the screen when i'm running a query.

i tried:

print 'Formatting Table1'
print datetime
go


got the following error:
Msg 128, Level 15, State 1, Line 2
The name "datetime" is not permitted in this context. Valid expressions are constants, constant expressions, and (in some contexts) variables. Column names are not permitted.

jezemine
Master Smack Fu Yak Hacker

2886 Posts

Posted - 2008-03-06 : 20:45:17
try:

print getdate()


elsasoft.org
Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2008-03-06 : 20:53:57
works perfect, how can i get it all on one line?

print 'blah blah blah' + getdate()

and

print 'blah blah blah' & getdate()

both toss errors


Thanks!
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-06 : 20:58:22
Print 'blah' + cast(getdate() as varchar)




Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2008-03-06 : 21:00:30
Perfect, thanks!
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-06 : 21:16:52
If you right click your query window, you can show "Properties Window", which will show stats on the query, including execution time...



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2008-03-06 : 21:25:10
thanks, but i actually want it to print to the message section. i'm re-formatting about 195 MILLION records, so i just wanna see when each stop finishes.


Thanks again!
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-06 : 21:46:42
ahhh....fun!



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page

albertkohl
Aged Yak Warrior

740 Posts

Posted - 2008-03-06 : 21:55:12
Joy's :p maybe you can help me really quick the server that i installed everything on is a quad-core 64x dual xeon. (my other was a dual core 32x dual xeon)

i know you have to specifically install the 64x version of sql to use the processors to the fullest extent, but can you run that install off the 32x disc's or is it a completely different set of discs?
Go to Top of Page

dataguru1971
Master Smack Fu Yak Hacker

1464 Posts

Posted - 2008-03-06 : 21:58:50
I don't have my MSDN binder at home, but I recall seeing separate install discs for 32x and 64x. Completely unsure, and I may be misunderstanding the question...but I think to install 64x version, you have to install using 64x discs



Poor planning on your part does not constitute an emergency on my part.

Go to Top of Page
   

- Advertisement -