A[L]C;17740829 said:Thats excellent s-p.
The date is coming out as 2010-11-04 06:37:57.270
Is there any way I can get it to be 2010-11-04 06:37:57 ie knock off the last 4 digits? No problem if not, I can do it in excel.
Also how would I search on timestamp?
Sorry, back at work this week so only just seen your post.
Knocking off the last 4 digits is a presentation issue and therefore something I'd recommend doing in Excel in all honesty. That being said, we can obtain the ODBC Canonical date format that you desire with a slight modification to the SQL.
Code:
SELECT
GenericXmlInfo.Xml.value('declare namespace C="http://tempuri.org/Alert.xsd"; (/C:Alert/C:Object/@Name)[1]','nvarchar(max)'),
CONVERT(VARCHAR(19), CONVERT(DateTime, REPLACE(GenericXmlInfo.Xml.value('declare namespace C="http://tempuri.org/Alert.xsd"; (/C:Alert/@TimeStamp)[1]', 'nvarchar(max)'), '+00:00', '')), 120)
FROM [VideoOS_Transact].[dbo].[GenericXmlInfo]
As for searching on the timestamp, it depends what type of search you're planning on doing? i.e. Do you need the ability to return all records where the date+time is before/after a certain point, or are you solely interested in querying the time aspect of the field.