RE: Archive data

RE: Archive data

 

  

You could build a datetime variable using CONVERT, SUBSTRING, and concatenation that makes the first day of each month. Then you could compare that to GETDATE() minus 13 months.

Diane Davis


-----Original Message-----
From: Elena Frenkel
[mailto:mssqldba-ezmlmshield-x76248908.[Email address protected]
Sent: Tuesday, February 22, 2005 2:29 PM
To: LazyDBA Discussion
Subject: Archive data


Hi all,
I need archiving data from the tables older than 13 months.
I don't have datetime column in my tables. The only column I have shows
month and year and looks like '200501' has 'char 6'.
How I can retrieve data older than 13 months?

Thank you.

-----Original Message-----
From: Schlieper Paul
[mailto:mssqldba-ezmlmshield-x94926167.[Email address protected]
Sent: Tuesday, February 22, 2005 2:06 PM
To: LazyDBA Discussion
Subject: RE: T-SQL to drop and add primary key

IF EXISTS (SELECT * FROM sysobjects WHERE name = '<pkname>')
BEGIN
ALTER TABLE <tablename>
DROP CONSTRAINT <pkname>

ALTER TABLE <tablename>
ADD CONSTRAINT <pkname>
PRIMARY KEY CLUSTERED/NONCLUSTERED (<col1>, <col2>,...<coln>)
END

P

-----Original Message-----
From: Dylan Jones
[mailto:mssqldba-ezmlmshield-x49908773.[Email address protected]
Sent: Tuesday, February 22, 2005 1:53 PM
To: LazyDBA Discussion
Subject: T-SQL to drop and add primary key


BOL offers so many choices any one have a script handy that shows an

example of dropping and adding a multi-column primary key?



Thanks in advance



Dylan



Get the latest news on SurfControl and our products,

subscribe to our monthly e-newsletter, SurfAdvisory at:

http://www.surfcontrol.com/resources/surfadvisory/surfadvisory_signup.aspx



*********************************************************************

The information in this email is confidential and may be legally

privileged. It is intended solely for the addressee. Access to this

email by anyone else is unauthorized. If you are not the intended

recipient, any disclosure, copying, distribution or any action taken

or omitted to be taken in reliance on it, is prohibited and may be

unlawful. If you believe that you have received this email in error,

please contact the sender.

*********************************************************************

SurfControl Inc.

5550 Scotts Valley Drive

Scotts Valley, California 95066

831-440-2500




---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]



---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]




---------------------------------------------------------------------
TO REPLY TO EVERBODY , PLEASE CLICK REPLY-ALL, NOT JUST REPLY
Website : http://www.LazyDBA.com
To unsubscribe: http://www.lazydba.com/unsubscribe.html
For additional commands, e-mail: mssqldba-[Email address protected]


MS Sql Server LazyDBA home page