| | |
Date Problem
Please support our MS SQL advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Sep 2006
Posts: 20
Reputation:
Solved Threads: 0
Hi Guys
I've got a bit of problem with date.
When I transfer data of a table to txt file the date column that appears in the table like "28/03/2001" changes to "28/3/2001 0:00:00" in the txt file. I've tried to change the format of date in the table but it doesn't help.I'm using the following code.
Thanks for your time
I've got a bit of problem with date.
When I transfer data of a table to txt file the date column that appears in the table like "28/03/2001" changes to "28/3/2001 0:00:00" in the txt file. I've tried to change the format of date in the table but it doesn't help.I'm using the following code.
MS SQL Syntax (Toggle Plain Text)
Private Sub Command2_Click() DoCmd.TransferText acExportDelim, "PESALES Export Specification", "PESALES", "J:\Power Equipment\Common\SK\PESALES.TXT" End Sub
Thanks for your time
I've been having such problem before. The reason why it chages "28/03/2001" to "28/3/2001 0:00:00" is because SQL requires most date/time parameter to be changed to such format. What I do is use CAST and SUBSTRING to convert the date intolong date.
Example: From "28/3/2001 0:00:00" I chaged it into "March 28, 2001"
Here's the code:
Example: From "28/3/2001 0:00:00" I chaged it into "March 28, 2001"
Here's the code:
MS SQL Syntax (Toggle Plain Text)
SELECT [whatever's the name of your date field], CASE WHEN [date field] IS NOT NULL THEN (SELECT SUBSTRING(CAST([date field] AS VARCHAR), 1, 11)) END AS [new date field name] FROM [whatever table you're USING]
![]() |
Similar Threads
- date problem (Visual Basic 4 / 5 / 6)
- SAS/Oracle Date Problem (Computer Science)
- SQL date problem (MS SQL)
- Small date problem (ASP)
- Dreamweaver MX2004 & date problem, etc. (Graphics and Multimedia)
- Date Problem (JSP)
Other Threads in the MS SQL Forum
- Previous Thread: IDENTITY question
- Next Thread: Splitting Full name data to First, Last
| Thread Tools | Search this Thread |
Tag cloud for MS SQL
"last autogrowth business connectingtodatabaseinuse count cursor data database dateadd datepart day" dbsize deadlock delete_trigger getdate highperformancecomputing hpc hpcserver2008 ibm iis loop maximum microsoft ms mssql multiple multithreading news number permission query reporting result server services sets source sql sqlserver sqlserver2005 supercomputing tables uniqueid update view weekday





