StumbleUpon  Facebook  Reddit  Add to diigo  

Follow - Monx007
Article Time Stamp: 15 September 2008, 23:33:18 GMT+7

Microsoft SQL (MS SQL): Sample SQL Script to Check If A Column Exists

Let's say, that we want to check whether a column, already exists in our table or not. We named our column as clmn_a and the table as tbl_a. And if it doesn't exists, then we just print to the screen 'Not Exists' words. Otherwise, we just print 'Already Exists' words.

IF NOT EXISTS (SELECT * FROM information_schema.columns WHERE table_name = 'tbl_a' AND column_name = 'clmn_a')
PRINT 'Not Exists'

PRINT 'Already Exists'

Article Source: Monx Digital Library

Copyrighted@ Monx Digital Library, otherwise stated
Use of our service is protected by our Terms of Use

 Back To Previous Page ...  




AQWorlds Nulgath Secret Walkthrough