Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 Losing milliseconds

Author  Topic 

devinev
Starting Member

16 Posts

Posted - 2004-10-23 : 19:37:41
I am exporting an SQL Server 2000 table to a comma delimited text file from a Visual Basic .Net application. The conversion of a datetime field loses the milliseconds value from the database. I cannot find too much information on this issue. Can anyone out there help.

Thanks,

VeeDee

nr
SQLTeam MVY

12543 Posts

Posted - 2004-10-23 : 22:34:55
Use an xplicit convertion to character rather than letting it default
e.g.
convert(varchar(30), getdate(), 113)

==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

devinev
Starting Member

16 Posts

Posted - 2004-10-24 : 12:22:58
nr

I tried your suggestion but it does not work. Below is an example of the code that works but does not give the correct results:

For Each Column in Table.Columns
sColTime = Convert.ToString(Row.Item(Column))
ProcessTime(sColTime)
Next

I tried your suggestion:
sColTime = Convert(varchar(30),Row.Item(Column),113)
Visual Basic does not like that instruction.

Any other suggestions.

Thanks,

VeeDee
Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2004-10-24 : 12:58:01
he meant you convert in into your sql statement not in VB.net


Go with the flow & have fun! Else fight the flow
Go to Top of Page
   

- Advertisement -