SELECT OBJECT_NAME(object_id)
FROM
sys.sql_modules
WHERE
OBJECTPROPERTY(object_id, 'IsProcedure') = 1
AND
definition LIKE
'%yourText%'Here we are see how to get the Increment & Seed Settings of Indentity in the table. IDENTITY(SEED,INCREMENT)== IDENTITY(10,5) Query Snippet: -- Create table with identity column CREATE TABLE MyOrders2 ( OrderID int IDENTITY(10,5), ProductName varchar(20) ); select IDENT_INCR('MyOrders2') -- 5 select IDENT_SEED ('MyOrders2') -- 10 drop table MyOrders2 -- Create table with identity column CREATE TABLE MyOrders2 ( OrderID int IDENTITY(100,50), ProductName varchar(20) ); select IDENT_INCR('MyOrders2') -- 50 select IDENT_SEED ('MyOrders2') – 100 Try After Reseting the Indentity by the below command: dbcc CHECKIDENT('MyOrders2',RESEED,10) It still shows the original setup in the table not the reset value by “CHECKIDENT” command. select IDENT_INCR('MyOrders2') -- 50 select IDENT_SEED ('MyOrders2') – 100
Returns the number of bytes used to represent any expression.
Here the “datalength “ funcion helps to find the size of the data in the column. For example data in the column is “ARUN” then it takes 4 bytes, because one charater takes one byte, likewise you can calculate for all datatypes.
-- Created table with Primary Key
CREATE TABLE MyOrdersPrimary
(
OrderId int PRIMARY KEY NOT NULL,
ProductName varchar(20)
);
-- Inserted some records
insert into MyOrdersPrimary values (1,'Samsung')
insert into MyOrdersPrimary values (2,'Nokia')
select datalength(ProductName) as Bytes, * from MyOrdersPrimary