SQL split function

DECLARE @str as varchar(max) SET @str = ‘Prakash,Sanket,Jigar,JD’ SELECT value as GiveColumName from dbo.split(@str,’,’) Split function used to insert to multiple records into tables…. see below procedure INSERT INTO BoqThermoDrawing SELECT @BoqNo,@RevisionNo,@RootPath+’\’+value from dbo.Split(@FileNames,’/’) —————————————————————– Create function in sql server… split after that u can use above function USE [DataBaseName] GO /****** Object: UserDefinedFunction [dbo].[Split] …

Check IsIdentity true or false

Find SQL Table Cloumn name, data type,  column size select column_name, data_type, character_maximum_length char from information_schema.columns where table_name=’tblCountry’ Find IsIdentity true columns SELECT * from information_schema.columns where columnproperty(object_id(table_name),column_name, ‘IsIdentity’)=1 and table_name=’personal’ Find IsIdentity False Columns SELECT * from information_schema.columns where columnproperty(object_id(table_name),column_name, ‘IsIdentity’)=0 and table_name=’personal’

Joins in SQL Server

Inner Joins It match records together based on one or more common fields, as do most JOINS but inner joins return only records where there are matches for whatever fields you have said are to be used for join. Join Two Tables Table_1 : Product_Master Table_2 : Sales_Order_Detaisl Query: select a.product_no,a.decscription from product_master a inner …

Find Tables List Structure Count Duplicate Records

use <database_name> Select DataBase using above query select * from information_schema.tables You can easily fine tables list using above syntax. sp_help <table_name> See particular table structure/Design. select s_order_no, count(s_order_no) As ‘SalesOrder’ from sales_order_details group by s_order_no having (count(s_order_no)>1) Find Duplicate Records In Table