Here’s query for finding duplicates in a table. Suppose you want to find all Usernames values in a table that exist more than once:
SELECT Username, COUNT(Username) AS NumOccurrences FROM Users GROUP BY Username HAVING (COUNT(Username) > 1)
Here’s query for finding duplicates in a table. Suppose you want to find all Usernames values in a table that exist more than once:
SELECT Username, COUNT(Username) AS NumOccurrences FROM Users GROUP BY Username HAVING (COUNT(Username) > 1)
In SQL Server 2005, in order to insert 3 rows to a table, you had to run 3 INSERT statements:
insert into Customers (Name, City, Phone) values (‘Customer #1’, ‘Jerusalem’, ‘2343245’)
insert into Customers (Name, City, Phone) values (‘Customer #2’, ‘Tel Aviv’, ‘0987345’)
insert into Customers (Name, City, Phone) values (‘Customer #3’, ‘Haifa’, ‘275466’)
In SQL Server 2008, you can insert multiple rows in a single insert statement that takes a number of value arrays:
insert into Customers (Name, City, Phone)
values
(‘Customer #1’, ‘Jerusalem’, ‘2343245’),
(‘Customer #2’, ‘Tel Aviv’, ‘0987345’),
(‘Customer #3’, ‘Haifa’, ‘275466’)
Enterprise Version vs Community version
Homepage: http://www.webyog.com