July 18, 2012 at 11:50 am
I have a table, with duplicate column,
how can i delete one row and keeping the another row.
July 18, 2012 at 11:54 am
Is it the row or the column that is of concern?
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 18, 2012 at 11:55 am
it is row.
July 18, 2012 at 11:57 am
Here is an article that should help.
http://jasonbrimhall.info/2011/03/21/dedupe-data-cte/
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 18, 2012 at 12:03 pm
Jason: I always wonder when I use CTE to delete duplicate rows.
CTE being ANSI compliant, why does it let us delete data from CTE? I am sure ANSI norms does not allow that. Has Microsoft gone a step ahead? 🙂
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
July 18, 2012 at 12:05 pm
Can I get T-sql statement.
July 18, 2012 at 12:08 pm
Danzz (7/18/2012)
Can I get T-sql statement.
Based on what? We don't have anything useful from you to provide you with any code that would be useful to you. If you provide us with the DDL for the table, some sample data, and expected results I'm sure we could come up with something quickly.
July 18, 2012 at 12:12 pm
Danzz (7/18/2012)
Can I get T-sql statement.
Actually if you read the article it is really quite simple.
_______________________________________________________________
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/
July 18, 2012 at 12:14 pm
lokeshvij (7/18/2012)
Jason: I always wonder when I use CTE to delete duplicate rows.CTE being ANSI compliant, why does it let us delete data from CTE? I am sure ANSI norms does not allow that. Has Microsoft gone a step ahead? 🙂
Not sure it is just Microsoft. I think Oracle allows the same.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 18, 2012 at 12:14 pm
Sean Lange (7/18/2012)
Danzz (7/18/2012)
Can I get T-sql statement.Actually if you read the article it is really quite simple.
Thank you.:-D
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 18, 2012 at 12:15 pm
Lynn Pettis (7/18/2012)
Danzz (7/18/2012)
Can I get T-sql statement.Based on what? We don't have anything useful from you to provide you with any code that would be useful to you. If you provide us with the DDL for the table, some sample data, and expected results I'm sure we could come up with something quickly.
Agree with Lynn. It is for this reason that an article reference with a clear example was given.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
July 18, 2012 at 12:16 pm
cool...Thanks Jason.
Much appreciated!
- Lokesh
~ Lokesh Vij
Link to my Blog Post --> www.SQLPathy.com[/url]
Follow me @Twitter
July 18, 2012 at 12:16 pm
SQLRNNR (7/18/2012)
Sean Lange (7/18/2012)
Danzz (7/18/2012)
Can I get T-sql statement.Actually if you read the article it is really quite simple.
Thank you.:-D
You're welcome. Not sure how I never found that one before. Great article on a frequent topic!!
_______________________________________________________________
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/
July 18, 2012 at 12:17 pm
SQLRNNR (7/18/2012)
lokeshvij (7/18/2012)
Jason: I always wonder when I use CTE to delete duplicate rows.CTE being ANSI compliant, why does it let us delete data from CTE? I am sure ANSI norms does not allow that. Has Microsoft gone a step ahead? 🙂
Not sure it is just Microsoft. I think Oracle allows the same.
Not sure, never tried it with their subquery refactoring clause.
July 18, 2012 at 12:22 pm
Lynn Pettis (7/18/2012)
SQLRNNR (7/18/2012)
lokeshvij (7/18/2012)
Jason: I always wonder when I use CTE to delete duplicate rows.CTE being ANSI compliant, why does it let us delete data from CTE? I am sure ANSI norms does not allow that. Has Microsoft gone a step ahead? 🙂
Not sure it is just Microsoft. I think Oracle allows the same.
Not sure, never tried it with their subquery refactoring clause.
Looks like most examples i find use a subquery or a ranking function (very similar to the cte).
I did check with a friend on the Oracle side that confirmed it would work if it is ansi compliant.
Jason...AKA CirqueDeSQLeil
_______________________________________________
I have given a name to my pain...MCM SQL Server, MVP
SQL RNNR
Posting Performance Based Questions - Gail Shaw[/url]
Learn Extended Events
Viewing 15 posts - 1 through 15 (of 16 total)
You must be logged in to reply to this topic. Login to reply