.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Interview Question >> Sql Server >> Post New Question Subscribe to Interview Questions

how to find column name from sql server table?

Posted By :Dhivakaran     Posted Date :November 22, 2010    Points :10   Category :Sql Server 
select * from INFORMATION_SCHEMA.Columns where column_name like 'colname%'

You can also find related Interview Question to how to find column name from sql server table?  below: 

More than one IDENTITY column per table can be exist in SQL Server . (True /False)

  
False.
There can only be one IDENTITY column per table in SQL Server.
Its auto Incremented Column defined by the user. (More...)

how to find the table name in sql server database?

  
select * from INFORMATION_SCHEMA.tables where table_name like 'tblname%' (More...)

How To Update Description Value for a Column in Table using SQL Command?

  
We can Update Description to Column using sp_updateextendedproperty System Store Procedure.
Sample Command to Update Description for Column in a Table:

EXEC sys.sp_updateextendedproperty @name=N'MS_Description', @value=N'My Description for Column Here' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MyTableName', @level2type=N'COLUMN',@level2name=N'ColumnName' (More...)

How To Delete Description Value for a Column in Table using SQL Command?

  
We can Delete Description from Column using sp_dropextendedproperty System Store Procedure.
Sample Command to Delete Description from Column in a Table:

EXEC sys.sp_dropextendedproperty @name=N'MS_Description', @value=N'My Description for Column Here' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'MyTableName', @level2type=N'COLUMN',@level2name=N'ColumnName' (More...)

How To Get Description Value for all Column in Table using SQL Command?

  
To Get Description of Columns we need to use system function sys.fn_listextendedproperty.
Command To Get Description Data for all Columns:

SELECT * FROM fn_listextendedproperty(NULL, 'SCHEMA',
'dbo', 'TABLE', 'YourTable Name Here', 'COLUMN', NULL) (More...)

How To Get Description Value for Single Column in Table using SQL Command?

  
To Get Description of Single Column we need to use system function sys.fn_listextendedproperty. we need to pass the column Name is this case.
Command To Get Description Data for Single Columns:

SELECT * FROM fn_listextendedproperty(NULL, 'SCHEMA',
'dbo', 'TABLE', 'Table Name Here', 'COLUMN', 'Column Name Here') (More...)

How can we find the open transactions details in sql server?

  
Yes, it is possible.

select * from sysprocesses where open_tran > 0


This query will provide list of all the open transaction details. (More...)

Which system table holds the details of all the processes running on the Microsoft sql server?

  
The name of the system table is sysprocesses .

Select * from sysprocesses


Make sure you run this query in master database. (More...)

To find a particular column name where it exists in a database?

  
The Query to find the particular column name in a databse is,

SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE COLUMN_NAME = 'User_name' (More...)

Can we insert a value for the identity Column in Sql Server?

  
Yes, We can insert the value for Identity column

using SET IDENTITY INSERT ON

e-g


CREATE TABLE #Temp(ID INT IDENTITY, EmpName VARCHAR(255))

SET IDENTITY_INSERT #Temp ON
INSERT INTO #Temp(ID, EmpName)
Values(10, 'Alwyn Duraisingh.M')
SET IDENTITY_INSERT #Temp OFF
(More...)

Quick Links For Interview Questions Categories:
ASP.Net Windows Application   .NET Framework   C#   VB.Net   ADO.Net  
Sql Server   SharePoint   Silverlight   OOPs   JQuery   JavaScript/VBScript
Biztalk Patten/Practices .IIS WCF WPF WWF
Networking Aptitude Others   All      

Find questions, FAQ's and their answers related to .NET, C#, Vb.Net, Sql Server and many more.

 
Now you can find lots of .NET, C#, Vb.Net, SQL Server,Windows, ASP.Net related Questions and their Answers here at www.dotnetspark.com. Our aim is to help you pass your certification Exams (MCP, MCSD, MCAD etc.,) with flying scores and get good name in your company.

So, Start looking our Interview Question section daily and improve your .NET Skills. You can also help others by posting Interview Questions and their Answers in this section.


Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend