August 17, 2012 at 3:07 am
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
August 17, 2012 at 3:16 am
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)?
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
August 17, 2012 at 3:22 am
no , i want to change those orders value to null [that column data type is datetime ]
August 17, 2012 at 3:23 am
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?
August 17, 2012 at 3:34 am
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 .
August 17, 2012 at 3:36 am
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 .
August 17, 2012 at 3:40 am
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...
August 17, 2012 at 3:42 am
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!
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
August 17, 2012 at 3:51 am
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?
August 17, 2012 at 4:01 am
Thanks to all
August 17, 2012 at 4:08 am
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!
:w00t: or :unsure: or perhaps :rolleyes:
My thought question: Have you ever been told that your query runs too fast?
My advice:
INDEXing a poor-performing query is like putting sugar on cat food. Yeah, it probably tastes better but are you sure you want to eat it?
The path of least resistance can be a slippery slope. Take care that fixing your fixes of fixes doesn't snowball and end up costing you more than fixing the root cause would have in the first place.
Need to UNPIVOT? Why not CROSS APPLY VALUES instead?[/url]
Since random numbers are too important to be left to chance, let's generate some![/url]
Learn to understand recursive CTEs by example.[/url]
[url url=http://www.sqlservercentral.com/articles/St
August 19, 2012 at 7:21 am
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...
I had the same confusion. It seemed too simple, but that would seem to be it, I think...
August 19, 2012 at 8:59 am
As others suggested the best way would be identifying the records you need to update because if you use the date as the filter you might end up updating more than you want.
Best regards,
Andre Guerreiro Neto
Database Analyst
http://www.softplan.com.br
MCITPx1/MCTSx2/MCSE/MCSA
Viewing 13 posts - 1 through 12 (of 12 total)
You must be logged in to reply to this topic. Login to reply