Hi
I have a Db2 data base in db2 the date and time stored including millisec.I want to get the data from DotNet C#. For comparing I have a data without milli sec.so i want to remove the millisec dta in db and compare .
This is my C# Query.
"SELECT " + "'(TIMESTAMP_FORMAT(StartDate,'YYYY-MM-DD HH24:MI:SS'))'"+ " FROM TableName where " + FirstName+ " = '" + fName + "'";
Can any one guide to get the result without Millisec.
Thanks
Loading
srujana thallamPosted Apr 16, 2014, 10:03 AM
Thanks for your post.But again it will shows error,the query will not run.
I am trying run it in DB2
Sachin MandavkarPosted Apr 16, 2014, 9:52 AM
Try this
Replace your
Query ---------> (TIMESTAMP_FORMAT(StartDate,'YYYY-MM-DD HH24:MI:SS'))
and write like this
convert(datetime, convert(char(19), StartDate, 120))
OR
dateadd(millisecond, -datepart(millisecond, StartDate), StartDate)