Trinthlo

SQL

Errors

 

How to List CPU Usage Per Database in SQL Server
http://dbadiaries.com/how-to-list-cpu-usage-per-database-in-sql-server/

SQL High CPU Troubleshooting Checklist
https://blogs.msdn.microsoft.com/docast/2017/07/30/sql-high-cpu-troubleshooting-checklist/

Understanding SQL Server Compatibility Levels
https://www.spiria.com/en/blog/web-applications/understanding-sql-server-compatibility-levels/

Code Examples

 

How do you import a large MS SQL .sql file?

https://stackoverflow.com/questions/431913/how-do-you-import-a-large-ms-sql-sql-file

sqlcmd -S localhost -d database_name -i C:\path\to\sql\script\script.sql -a 32767

 

Add Primary Key

ALTER TABLE Countries ADD CONSTRAINT PK_Countries_CountryId PRIMARY KEY CLUSTERED (CountryId);

Drop Primary Key

ALTER TABLE countries DROP CONSTRAINT PK_Countries_CountryId

 

Running a large sql file in studio

sqlcmd -S <Servername> -U <Username> -P <password> -d <Databasename> -i <filename>