Answer Posted / divya mahendra sikarwar
Execute queries:
CREATE TABLE dbo.Test1 (
[ID] [int] ,
[FirstName] [varchar](25),
[LastName] [varchar](25)
) ON [PRIMARY]
INSERT INTO Test1 VALUES(1, ‘Bob’,'Smith’)
INSERT INTO Test1 VALUES(2, ‘Dave’,'Jones’)
INSERT INTO Test1 VALUES(3, ‘Karen’,'White’)
INSERT INTO Test1 VALUES(1, ‘Bob’,'Smith’)
INSERT INTO Test1 VALUES(4, ‘Bobby’,'Smita’)
select identity(int,1,1) as SlNo,* into #temp from Test1
DELETE
FROM #temp
WHERE SlNo NOT IN
(
SELECT MAX(SlNo)
FROM #temp
GROUP BY ID,FirstName,lastname
)
drop table test1
select * into test1 from #temp
alter table test1 drop column SlNo
select * from test1 order by id
| Is This Answer Correct ? | 6 Yes | 0 No |
Post New Answer View All Answers
What is the difference between writing data to mirrored drives versus raid5 drives
What will be the maximum number of index per table?
How to get a list of columns in a view using "sys.columns" in ms sql server?
What do you understand by mirroring and mention the advantages of the mirroring?
Can we take the full database backup in log shipping?
What are the new features in SQL Server 2005 when compared to SQL Server 2000?
What are the different types of upgrades that can be performed in sql server?
What are various ways to enhance the ssrs report?
plss anybody specify tha constrian management system in dbms
Write a SQL command to insert and update only a particular field?
How do I create a trace in sql server?
What are types of scd? : sql server analysis services, ssas
what are the Prerequisites for Replication?
How to override dml statements with triggers?
What is normalization of database? What are its benefits?