IF EXISTS(SELECT * FROM sys.columns WHERE Name = N'columnName' AND Object_ID = Object_ID(qualified.table.name')) BEGIN PRINT 'Column Exists' END --OR IF COL_LENGTH('qualified.table.name','column_name') IS NULL BEGIN PRINT 'Column does not exist or caller does not have permission to view the object' END
world wide web development problems asp net php html xhtml css javascript jquery w3dproblems
Monday, January 11, 2016
How to check if column exists in SQL Server table
Tuesday, December 22, 2015
How do I reset a sequence in sql
ALTER SEQUENCE Schema.SequenceName
RESTART WITH 1
RESTART WITH 1
Identity jump issue in sql server
- Open "SQL Server Configuration Manager"
- Click "SQL Server Services" on the left pane
- Right-click on your SQL Server instance name on the right pane ->Default: SQL Server(MSSQLSERVER)
- Click "Properties"
- Click "Startup Parameters"
- On the "specify a startup parameter" textbox type "-T272"
- Click "Add"
- Confirm the changes
Monday, November 16, 2015
Set the width of select2 input
$("select").select2({ width: 'resolve' });
OR
$("select").select2({ width: '100%' });
OR
$("select").select2({ dropdownAutoWidth : true });
OR
$("select").select2({ width: '100%' });
OR
$("select").select2({ dropdownAutoWidth : true });
Thursday, November 12, 2015
Determine Whether a Table Has an Identity Column
SQL Server 2005+
SMO
SELECT OBJECTPROPERTY(object_id('TableToBeChecked'), 'TableHasIdentity')
SMO
Server srv = new Server("(local)");
Database db = srv.Databases["AdventureWorks2012"];
Table tb = new Table(db, "Test Table");
Column col1 = new Column(tb, "TableIdentifier", DataType.Int);
col1.Identity = true;
tb.Columns.Add(col1);
try
{
foreach (String s in tb.CheckIdentityValue())
{
Console.WriteLine(s);
}
}
catch
{
}
Subscribe to:
Comments (Atom)