Search
 
SCRIPT & CODE EXAMPLE
 

SQL

query to generate query to drop primary keys or foreign key in ms sql server

DECLARE @sql NVARCHAR(MAX) = N'';

SELECT @sql += N'
ALTER TABLE ' + QUOTENAME(OBJECT_SCHEMA_NAME(parent_object_id))
    + '.' + QUOTENAME(OBJECT_NAME(parent_object_id)) + 
    ' DROP CONSTRAINT ' + QUOTENAME(name) + ';'
FROM sys.foreign_keys WHERE QUOTENAME(OBJECT_NAME(parent_object_id)) LIKE '%[tblAccount]%'

PRINT @sql;
Comment

PREVIOUS NEXT
Code Example
Sql :: run eroku psql 
Sql :: make a socket server to detect changes in mysql 
Sql :: swiftui onappear only once 
Sql :: how to check rollback status in oracle 
Sql :: pl sql oracle trigger update exclude site:stackoverflow.com 
Sql :: sqlalchemy datetime utcnow 
Sql :: mysql create index lost connection 
Sql :: sqlalchemy how to use sequence 
Sql :: cube oracle 
Sql :: mysql set session timeout 
Sql :: SQL BETWEEN OPERATOR With Texts 
Sql :: SQL ANY and ALL Operators 
Sql :: SQL authentication error 
Sql :: get the previous column of a table in mysql 
Sql :: sql after date 
Sql :: Get the Domain Name, Page Name and Query Parameter from a URL 
Sql :: What are the advantages of MySQL when compared with Oracle? 
Sql :: SQLALCHEMY track is set to true or false 
Sql :: mysql installer no packages found 
Sql :: plsql select intop 
Sql :: TSQL Code Snippet For Optimized Sales Query 
Sql :: odoo there is no primary key for referenced table "res_users" 
Sql :: remove an object that is dependent on a column in sql 
Sql :: md5 encryption for existing records 
Sql :: hoq to import database source 
Sql :: OLAP queries 
Sql :: stored procedure function relation 
Sql :: Resulting Query 
Sql :: how to change oracle sid name in 19c database 
Sql :: conditional index in postgres 
ADD CONTENT
Topic
Content
Source link
Name
6+9 =