dedmedved / cheburashka Goto Github PK
View Code? Open in Web Editor NEWSQL Server/TSQL static code analysis add-in for Visual Studio SSDT projects
License: Apache License 2.0
SQL Server/TSQL static code analysis add-in for Visual Studio SSDT projects
License: Apache License 2.0
Use these docs as a guid to the functionality.
Examples
A. Renaming a table
The following example renames the SalesTerritory table to SalesTerr in the Sales schema.
SQL
USE AdventureWorks2012;
GO
EXEC sp_rename 'Sales.SalesTerritory', 'SalesTerr';
GO
B. Renaming a column
The following example renames the TerritoryID column in the SalesTerritory table to TerrID.
SQL
USE AdventureWorks2012;
GO
EXEC sp_rename 'Sales.SalesTerritory.TerritoryID', 'TerrID', 'COLUMN';
GO
C. Renaming an index
The following example renames the IX_ProductVendor_VendorID index to IX_VendorID.
SQL
USE AdventureWorks2012;
GO
EXEC sp_rename N'Purchasing.ProductVendor.IX_ProductVendor_VendorID', N'IX_VendorID', N'INDEX';
GO
D. Renaming an alias data type
The following example renames the Phone alias data type to Telephone.
SQL
USE AdventureWorks2012;
GO
EXEC sp_rename N'Phone', N'Telephone', N'USERDATATYPE';
GO
E. Renaming constraints
The following examples rename a PRIMARY KEY constraint, a CHECK constraint and a FOREIGN KEY constraint. When renaming a constraint, the schema to which the constraint belongs must be specified.
SQL
USE AdventureWorks2012;
GO
-- Return the current Primary Key, Foreign Key and Check constraints for the Employee table.
SELECT name, SCHEMA_NAME(schema_id) AS schema_name, type_desc
FROM sys.objects
WHERE parent_object_id = (OBJECT_ID('HumanResources.Employee'))
AND type IN ('C','F', 'PK');
GO
-- Rename the primary key constraint.
sp_rename 'HumanResources.PK_Employee_BusinessEntityID', 'PK_EmployeeID';
GO
-- Rename a check constraint.
sp_rename 'HumanResources.CK_Employee_BirthDate', 'CK_BirthDate';
GO
-- Rename a foreign key constraint.
sp_rename 'HumanResources.FK_Employee_Person_BusinessEntityID', 'FK_EmployeeID';
-- Return the current Primary Key, Foreign Key and Check constraints for the Employee table.
SELECT name, SCHEMA_NAME(schema_id) AS schema_name, type_desc
FROM sys.objects
WHERE parent_object_id = (OBJECT_ID('HumanResources.Employee'))
AND type IN ('C','F', 'PK');
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.