Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Referencing a field from a SQL
Message
 
 
To
04/03/2008 21:47:04
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01298743
Message ID:
01298758
Views:
18
This message has been marked as the solution to the initial question of the thread.
>What I mean is that I am executing a SQL against the INFORMATION_SCHEMA.KEY_USAGE object. It extracts the constraint column name of the table I am passing in the WHERE clause. So, once the SQL is executed, how can I use that field? The field name in the SQL is Constraint_Name.
DECLARE @CONSTRAINT_NAME nvarchar(128)

SELECT @CONSTRAINT_NAME = CONSTRAINT_NAME
  FROM INFORMATION_SCHEMA.KEY_USAGE   
  WHERE ...

DECLARE @sql varchar(4000) 
SET @sql = 'ALTER TABLE DROP CONSTRAINT ' + @CONSTRAINT_NAME 
EXECUTE (@sql)
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform