Posted by John Bell on 12/28/05 17:20
Hi
If you are parsing a string then you constructing the date in CCYYMMDD
format will be a safe option.
John
<newtophp2000@yahoo.com> wrote in message
news:1135777730.480129.321010@z14g2000cwz.googlegroups.com...
> David Portas wrote:
>> You say BCP isn't an option but you didn't explain what other method
>> you are using to read the file or why a cursor is necessary. Don't rely
>> on SET DATEFORMAT. Use the CONVERT function with the style parameter to
>> specify the exact format. Looks like style 3 or 103 is what you need.
>
>
> I read from the file line by line and parse the line to extract the
> fields. I then use the bound variables in the prepared Insert
> statement to add it to the database. I wanted to change the DATEFORMAT
> configuration as it seemed to be such a straight answer. I guess I
> could use the CONVERT function if it is fast enough. I can do some
> tests to see how it performs.
>
> I am curius: is there a particular reason to shy away from setting
> DATEFORMAT? Is it not reliable as implemented or something else?
>
> Thanks a lot!
>
>
>> --
>> David Portas
>> SQL Server MVP
>> --
>
Navigation:
[Reply to this message]
|