Posts

Showing posts with the label SQL SERVER

Get the SQL Server Information from Query

Some times we need to get the information of the SQL Server where it is installed. Simply we can get the info from Query also -- Get the version info select @@version We have a in-built stored procedure called 'xp_msver' to the Server information. -- Get the Server Information exec xp_msver This is a basic information provided but may be useful to the SQL Server learners . Good day :-)

Set the Default Value to the Column Of a Table Programmaticaly

Normally we face this type of problem when we want to set the column default value pro-grammatically. To Solve this problem we need to first get the table column information using this Query. "SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME='person'" . Here the table name may vary. when we execute this Query we will get the each column information . So based on this we can Iterate the each column and get the each column Information as given below        VB.NET  Private Sub Initialise_The_Table(ByVal ReqTab As String) On Error GoTo handle_error Dim eachTableAdapter As SqlDataAdapter Dim tableDataset As New DataSet Dim adoHelper As SQLHelper = SQLHelper.GetInstance eachTableAdapter = adoHelper.GetAdapter("SELECT * FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE_NAME = '" + ReqTab + "'") eachTableAdapter.FillSchema(tableDataset, SchemaType.Source, ReqTab) eachTableA...