Follow by Email

Monday, 3 December 2012

How to check for any particular column name exists in which table of database in Sql Server

Using below written query we can get the name of the tables, in which passed column name is present/exist in database:

SELECT TABLE_SCHEMA + '.' + TABLE_NAME AS NameOfTables
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME = 'MyColumnName'

Here,
MyColumnName = Name of the column which you want to find, that in which table it exists.

Enjoyyy.....

3 comments:

MANOJ PANDAGRE said...

i think it is also work


select table_name,column_name from information_schema.columns
where column_name like '%tax%'

MANOJ PANDAGRE said...

i want know about the Query when we forget the password of admin how to rest new password?

abhinav ranjan sinha said...

@manoj: HI you can use like this:

Update loginTableName SET password='NewPass' Where username='UserName'


Note: on the place of :
loginTableName : use your table name in which you have username and password saved, then
NewPass: Use the new password which you want to set.
UserName: Use the username of Admin which you use for login.

Here,
password and username are column names change accordingly with your column names in database table.

Thanks

Post a Comment


                                                            

 
Design by Abhinav Ranjan Sinha