August 16, 2013 at 7:03 am
How to code to delete record in ORDERDATE for bbb?
NAME------ORDERDATE
------------------------------------
aaa 2013-05-02 00:00:00.000
bbb 2013-06-03 00:00:00.000
ccc NULL
August 16, 2013 at 7:06 am
delete from mytable where name = somename and date = somedate.
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 16, 2013 at 7:09 am
This will delete entire row.
What I need is to delete data in [ORDERDATE] cell and keep bbb in [NAME] field.
August 16, 2013 at 7:15 am
adonetok (8/16/2013)
This will delete entire row.What I need is to delete data in [ORDERDATE] cell and keep bbb in [NAME] field.
An UPDATE then.
update mytable set date = NULL where name = somename and date = somedate
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 16, 2013 at 7:15 am
adonetok (8/16/2013)
This will delete entire row.What I need is to delete data in [ORDERDATE] cell and keep bbb in [NAME] field.
That isn't a delete. It is an update.
Update table set orderdate = null where name = 'bbb'
_______________________________________________________________
Need help? Help us help you.
Read the article at http://www.sqlservercentral.com/articles/Best+Practices/61537/ for best practices on asking questions.
Need to split a string? Try Jeff Modens splitter http://www.sqlservercentral.com/articles/Tally+Table/72993/.
Cross Tabs and Pivots, Part 1 – Converting Rows to Columns - http://www.sqlservercentral.com/articles/T-SQL/63681/
Cross Tabs and Pivots, Part 2 - Dynamic Cross Tabs - http://www.sqlservercentral.com/articles/Crosstab/65048/
Understanding and Using APPLY (Part 1) - http://www.sqlservercentral.com/articles/APPLY/69953/
Understanding and Using APPLY (Part 2) - http://www.sqlservercentral.com/articles/APPLY/69954/
August 16, 2013 at 7:17 am
UPDATE [tableName]
SET [datetimeColumnName] = NULL
WHERE [datetimeColumnName] = 'dateTime'
AND [firstColumn] = 'someDataHere'
This will "delete" the data in that one row's specific column.
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply