Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12»»

how to change the date value to null?? Expand / Collapse
Author
Message
Posted Friday, August 17, 2012 3:07 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 7, 2014 7:02 AM
Points: 204, Visits: 764
hi ,

I have a column with date datatype. i updated the column with some date like 02-02-2012 00.00.000 ,for 100 orders Now i want to change the value for those 100 orders to NULL . how can i change ???


Thanks
lavanya
Post #1346409
Posted Friday, August 17, 2012 3:16 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:56 AM
Points: 7,208, Visits: 13,667
Lavanyasri (8/17/2012)
hi ,

I have a column with date datatype. i updated the column with some date like 02-02-2012 00.00.000 ,for 100 orders Now i want to change the value for those 100 orders to NULL . how can i change ???


Thanks
lavanya


Looks like a datetime datatype?

Do any orders other than the 100 you've just changed have the same value in the column?
Do you have auditing columns on the table (e.g. LastModifiedDatetime, LastModifiedBy)?


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1346412
Posted Friday, August 17, 2012 3:22 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 7, 2014 7:02 AM
Points: 204, Visits: 764
no , i want to change those orders value to null [that column data type is datetime ]
Post #1346416
Posted Friday, August 17, 2012 3:23 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 7:27 AM
Points: 2,836, Visits: 5,067
Lavanyasri (8/17/2012)
hi ,

I have a column with date datatype. i updated the column with some date like 02-02-2012 00.00.000 ,for 100 orders Now i want to change the value for those 100 orders to NULL . how can i change ???


Thanks
lavanya


Are these 100 orders can be identified as WHERE [column] = '20120202' or this one will return more than 100 orders you want to set to NULL?


_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1346418
Posted Friday, August 17, 2012 3:34 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 7, 2014 7:02 AM
Points: 204, Visits: 764
table name :xyz coulumname is :submitdate datatype is : datetime

Initially submitdate by default is null

i updated the column for 100 orders to '02-02-2012 00.00.000'

update xys set submitdate='02-02-2012 00.00.000' where id in ('1','2'.........'100')

Now i want to revert back those 100 orders submitdate value to null .



Post #1346425
Posted Friday, August 17, 2012 3:36 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 7, 2014 7:02 AM
Points: 204, Visits: 764
table name :xyz coulumname is :submitdate datatype is : datetime

Initially submitdate by default is null

i updated the column for 100 orders to '02-02-2012 00.00.000'

update xys set submitdate='02-02-2012 00.00.000' where id in ('1','2'.........'100')

Now i want to revert back those 100 orders submitdate value to null .



Post #1346426
Posted Friday, August 17, 2012 3:40 AM


Ten Centuries

Ten CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen CenturiesTen Centuries

Group: General Forum Members
Last Login: Today @ 8:54 AM
Points: 1,237, Visits: 9,797
This sounds a really simplistic question, but based on what you've said, it should just be:

update xys set submitdate=NULL where id in ('1','2'.........'100')

I feel I must be missing something as surely if you know how to set the rows to one value, you know how to set it to another...
Post #1346429
Posted Friday, August 17, 2012 3:42 AM


SSCertifiable

SSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiableSSCertifiable

Group: General Forum Members
Last Login: Today @ 8:56 AM
Points: 7,208, Visits: 13,667
HowardW (8/17/2012)
This sounds a really simplistic question, but based on what you've said, it should just be:

update xys set submitdate=NULL where id in ('1','2'.........'100')

I feel I must be missing something as surely if you know how to set the rows to one value, you know how to set it to another...


If I could find an emoticon for perplexed, it would be right here!


“Write the query the simplest way. If through testing it becomes clear that the performance is inadequate, consider alternative query forms.” - Gail Shaw

For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
Exploring Recursive CTEs by Example Dwain Camps
Post #1346430
Posted Friday, August 17, 2012 3:51 AM
SSCrazy

SSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazySSCrazy

Group: General Forum Members
Last Login: Yesterday @ 7:27 AM
Points: 2,836, Visits: 5,067
ChrisM@Work (8/17/2012)
HowardW (8/17/2012)
This sounds a really simplistic question, but based on what you've said, it should just be:

update xys set submitdate=NULL where id in ('1','2'.........'100')

I feel I must be missing something as surely if you know how to set the rows to one value, you know how to set it to another...


If I could find an emoticon for perplexed, it would be right here!


Let me guess: OP has closed the window with the list of real id's he updated

... where id in ('1','2'.........'100')

Now he tries to get it back from us...

My question was: would the query SELECT * FROM orders WHERE SubmittedDate = '20120202' return 100 records or else?


_____________________________________________
"The only true wisdom is in knowing you know nothing"
"O skol'ko nam otkrytiy chudnyh prevnosit microsofta duh!"
(So many miracle inventions provided by MS to us...)

How to post your question to get the best and quick help
Post #1346435
Posted Friday, August 17, 2012 4:01 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, August 7, 2014 7:02 AM
Points: 204, Visits: 764
Thanks to all
Post #1346445
« Prev Topic | Next Topic »

Add to briefcase 12»»

Permissions Expand / Collapse