In a procedure that I am writing I have a select statement and need to say give me such and such results from the table where DateEntered is the first of the previous month??
Could somebody help me with that please?I can get you to the "first of the prior month", but you'll have to do the dirty deed from there on in. I'd use:SELECT DateAdd(month, -1, Convert(CHAR(8), GetDate(), 121) + '01')-PatP|||Well that is great!!!!
This procedure will run a query once a month in the background,how can capture that data in a file and save it on my pc without doing it manually?|||Use OSQL.EXE (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dtsrunui/dts_helprunui_6wq9.asp) to execute the stored procedure. You may want to start osql.exe from a job (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adminsql/ad_automate_42r7.asp) in the SQL Agent.
-PatP|||This procedure will run a query once a month in the background,how can capture that data in a file and save it on my pc without doing it manually?
configure a job which runs monthly which does this for you.sql
No comments:
Post a Comment