November 23, 2010 at 12:24 pm
Howdy,
New to sql server.
I have a sql server script that needs to run. It runs fine. but it doesn't have any logging statements in it. can some show me how to write to log onto file server when the script runs.
this is the script I have and I want to write to an ascii file (on file server), the timestamp when this script started running and the content of @TableName and timestamp when this script ended running.
Thanks
DECLARE @TableName varchar(255)
DECLARE TableCursor CURSOR FOR
SELECT table_name FROM information_schema.tables
where TABLE_TYPE = 'BASE TABLE' and TABLE_SCHEMA = 'dbo'
OPEN TableCursor
FETCH NEXT FROM TableCursor INTO @TableName
WHILE @@FETCH_STATUS = 0
BEGIN
DBCC DBREINDEX(@TableName,' ',90)
FETCH NEXT FROM TableCursor INTO @TableName
END
CLOSE TableCursor
DEALLOCATE TableCursor
November 23, 2010 at 12:28 pm
Please do NOT waste people's time by cross-posting!!!
All: do not respond to this post; please use http://www.sqlservercentral.com/Forums/Topic1025402-391-1.aspx.
+--------------------------------------------------------------------------------------+
Check out my blog at https://pianorayk.wordpress.com/
November 23, 2010 at 10:39 pm
Ray K (11/23/2010)
Please do NOT waste people's time by cross-posting!!!All: do not respond to this post; please use http://www.sqlservercentral.com/Forums/Topic1025402-391-1.aspx.
Whoa! No need to yell, Ray. And considering the OP only has 3 posts, you might want to take the time to explain why cross-posting is such a bad idea. 😉
--Jeff Moden
Change is inevitable... Change for the better is not.
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply