Friday 19 April 2019

Get data with comma separated string from table using sql server

/////////////


DECLARE @StrClm varchar(50)
set @StrClm='1,2,3,4,5,6,7'
DECLARE @ListStr VARCHAR(MAX),@Ids varchar(50) = ''
set @Ids=','+@StrClm+','
SELECT @ListStr = COALESCE(@ListStr+',' ,'') + Description FROM mst_990Lookup where LookupFlag=36 and Charindex(','+cast(LookupCode as varchar(8000))+',', @Ids) > 0 --and Flag=1

Tuesday 16 April 2019

Add a geography column for fetching lat long using geojson in sql server


DECLARE @g geography;
SET @g = geography::STGeomFromText('POINT(16.0557 75.9547)', 4326);
SELECT cast(@g.ToString() as geography)



Result------------

0xE6100000010C705F07CE19FD52402063EE5A420E3040

Friday 5 April 2019

Save & Retrieve Hindi, Marthi Content in Sql Server database


declare @str nvarchar(100)=N'मै, तुम, हम, वे , इन्होने , अपने , पराये'

select (@str)
Insert into test(TextName) values (@str)
----------where N is the Nvarchar value >> N = NVARCHAR
----------and field datatype should be nvarchar(max)




         

Excel Sort values in ascending order using function TEXTJOIN

 Excel ::  Text ::  1,3,5,2,9,5,11 Result :: 1,2,3,5,5,9,11 Formula ::     TEXTJOIN ( ",",1,SORT(MID(SUBSTITUTE( A1 ,","...