Hello, Can any body help me that how can i use spool in sql server 2005 i dont want to use management studio to run this query i want some scheduler to run this query everymonth automatically . select name ,'current_date'=getdate (),size*8/1024,@@servername as servername from sys.database_files plz help me Regards Jagpal singh
but how can i attach this query in scheduler select name ,'current_date'=getdate (),size*8/1024,@@servername as servername from sys.database_files
You would get such an information from updated books online for SQL Server - http://sqlserver-qa.net/blogs/tools...able-for-download-update-your-local-copy.aspx to download. Further on tutorials http://www.microsoft.com/technet/prodtechnol/sql/2005/newsqlagent.mspx http://www.sql-server-performance.com/articles/dba/sql_server_agent_p1.aspx http://msdn2.microsoft.com/en-us/library/ms187061.aspx - http://www.quackit.com/sql_server/tutorial/sql_server_agent.cfm
hello, Actually we need this query result in file i dont want to run this query manually everytime bcause we are dealing with 10 to 12 servers so we need this query result in file .like we do in oracle (spool)to check that how much size is increazing and all details.#select name ,'current_date'=getdate (),size*8/1024,@@servername as servername from sys.database_files thaxxxxxxxx
Check out the bcp command in Books Online - it is an ugly old-school command-line utility, and it may require a few refinements to make it work for your various databases. You can save the bcp script as a stored procedure, and schedule a job to execute this at whichever interval you may need. Other than that, I would recommend that you look at Satya's recommendations.
Hey Adriaan, BCP is not ugly old-school rather say the golden provision for the DB users to insert data efficiently without complaining much about SQL alone [].
Hello , satya thaxx for replying me i have done by sqlcmd sqlcmd -S (local) -E -y -d master -i f:jagpalsql.sql -o f:jagpalsqlsql.txt copy /y dbastats.txt temp.txt copy /Y temp.txt + sqlsql.txt dbastats.txt thaxx regards jagpalsingh
<P mce_keep="true">[quote user="satya"] <P>Hey Adriaan, BCP is not ugly old-school rather say the golden provision for the DB users to insert data efficiently without complaining much about SQL alone <IMG alt=Wink src="http://sql-server-performance.com/Community/emoticons/emotion-5.gif">. </P>[/quote]The only use I've had for BCP was for dumping results to text files, and it usually involved dynamic SQL to compile the BCP command line. Be honest - it doesn't get much uglier than that, with all the switches and single quotes and double qoutes.[]