Tag Archives: SQLServer

SQL

Finding Duplicates with SQL

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)

Microsoft SQL Server

Problem with Identity Specification in SQL…

Error message when changing the identity column to “Yes” and save the changes:

“Saving changes is not permitted. The changes you have made require the following tables to be dropped and re-created. You have either made changes to a table that can’t be re-created or enabled the option Prevent saving changes that require the table to be re-created.”

It’s not a bug. It’s a safety measure added to SQL 2008’s management studio to indicate that the change that you’ve requested to the table requires that the table be dropped and recreated.

It’s there so that people don’t ‘accidentally’ make changes in production that will take hours.

use “SET IDENTITY_INSERT” command, for more info, see SQL BOL.

Or turn off the warning under tools–>options–>designers–>table and database designers

uncheck prevent saving changes that require table re-creation

Microsoft SQL Server

SQL Server 2008 Editions: Enterprise and Standard

Enterprise

SQL Server 2008 Enterprise is a comprehensive data platform that meets the high demands of enterprise online transaction processing and data warehousing applications.

Standard

SQL Server 2008 Standard is a complete data management and business intelligence platform providing best-in-class ease of use and manageability for running departmental applications.

KEY:

= Full

= Partial/Limited

= Not Available

SQL Server 2008 Enterprise Edition

SQL Server 2008 Standard Edition

Number of CPUs

OS Maximum

4

Scalability & Performance

Available
Limited

High Availability (Always On)

Available
Limited

Enterprise Security

Available
Limited

Data Warehousing

Available
Not Available

Business Intelligence

Available
Limited

Enterprise Manageability

Available
Not Available

Review the detailed feature comparison.

Source link: http://www.microsoft.com/sqlserver/2008/en/us/compare-std-ent.aspx

SQL Server

SQL Server: Duplicação de registos indexados

———————————————————————-
— Carlos Galhano 2009.02.05
— Duplicação de Registos indexados
–tab teste: testeid,titulo
–tab teste2: teste2id,titulo2,testeid
———————————————————————-
Alter table teste add oldid integer
———————————————————————-
Select TesteID, Titulo INTO #tmpteste FROM teste
go
insert into teste (Titulo,oldid) (Select Titulo,testeid from #tmpteste)
go

—————–
Select teste.TesteID, teste2.Titulo2 INTO #tmpteste2 FROM teste2 inner join teste on teste.oldid=teste2.testeid
go
—————–
insert into teste2 (Titulo2,testeID)
((Select Titulo2,testeid from #tmpteste2 ))
go
—————–
drop table #tmpteste
go
drop table #tmpteste2
go
—————–
Alter table teste drop column oldid
———————————————————————-