convert string to date
If you have only three underscore in your xml filename, you can try this as well:SELECT replace(parsename(replace(replace([fileName],'.','|'),'_','.'),1),'|xml','') FROM test
View Articleconvert string to date
The reverse of .xml is lmx.. I just want to remove it from the final string segment with replace function.
View Articleconvert string to date
SELECT *,Reverse(Replace(Stuff(REVERSE(FILENAME),CHARINDEX('_',REVERSE(FILENAME)),Len(FILENAME),'') ,'lmx.','')) dt FROM test
View Articleconvert string to date
DECLARE @tbl TABLE ( ID INT IDENTITY(1,1) PRIMARY KEY , [fileName] VARCHAR(100) ); INSERT INTO @tbl([fileName]) VALUES ('abcd_efgh_stry_2018-11-02.xml') , ('ghjk_tfgh_2018-11-02.xml'); select...
View Articleconvert string to date
HI create table #a ( ID INT IDENTITY(1,1) PRIMARY KEY , [fileName] VARCHAR(100) ) INSERT INTO #a([fileName]) VALUES('abcd_efgh_stry_2018-11-02.xml'), ('ghjk_tfgh_2018-11-02.xml'); --select * from #a;...
View Articleconvert string to date
create table #temp (col1 varchar(200)) insert #temp values ('abcd_efgh_stry_2018-11-02.xml'),('ghjk_tfgh_2018-11-02.xml')select...
View Articleconvert string to date
Hi Rajm,If the format of final string 'xxxx-xx-xx.xml' is fixed, then you can use following code: IF OBJECT_ID('test') IS NOT NULL drop table test create table test( col varchar(100)) go insert into...
View Articleconvert string to date
Hi Rajm0019,Here we go:DECLARE @tbl TABLE ( ID INT IDENTITY(1,1) PRIMARY KEY , [fileName] VARCHAR(100) ); INSERT INTO @tbl([fileName]) VALUES ('abcd_efgh_stry_2018-11-02.xml') ,...
View Articleconvert string to date
Hi I have a filenames as abcd_efgh_stry_2018-11-02.xml ghjk_tfgh_2018-11-02.xml , I need an help on how to extract date from this strings.Please adviceThanks
View Article