tags:

views:

17

answers:

1

Here's my query

Dim query as String = "Select * from openquery (devbook, 'SELECT wb.arrival_time FROM web_bookings wb ')"

All I need is to convert my arrival_time into a datetime field in the query

Is this possible?

Thanks

Jamie

+2  A: 

Yes, "SELECT CONVERT (DATETIME, wb.arrival_time, XXX) FROM web_bookings wb"

Where XXX is the format of your string...

Check out http://msdn.microsoft.com/en-us/library/ms187928.aspx for the list of format codes...

So if your string date time was in dd/MM/yyyy format eg 28/12/2008 then your code would be

Dim query as String = "Select * from openquery (devbook, 'SELECT CONVERT (DATETIME, wb.arrival_time, 103) FROM web_bookings wb ')"
Matt Fellows