Drop Table

Support Forum for database administrators and web based access to important newsgroups related to databases
Register on Database Support Forum Edit your profileCalendarFind other Database Support forum membersFrequently Asked QuestionsSearch this forum -> 
For Database admins: Free Database-related Magazines Now Free shipping to Texas


Post New Thread










Thread
Author

drop the time
I have a field in my table that is set as DATETIME

The data that gets imported to it is a text file and has teh data with teh
time.
for example, 1/1/2006 4:57:12 PM

I want to get rid of teh time part

How can I make it so the data that I already have in the table will drop teh
time??



Report this thread to moderator Post Follow-up to this message
Old Post
Johnfli
03-31-06 01:23 AM


RE: drop the time
Hi

In a SQL Server datetime field you will always have a time part even if you
don't specify the time it will default to midnight (00:00.000).

You don't say how the data is imported and if that is the only way the
column gets populated?

If you use DTS to load the data, you could use an activeX transform to
truncate the datetime field before it is inserted. If you use BCP/BULKINSERT
you can specify a format file that splits off the time and ignores it.
Another method is to load the data into a staging table and manipulate it
from there whilst it is being inserted into the final destination. You could
also use an instead of trigger (but you would need to make sure that it fire
s
for your bulk insert), or possibly have a computed column that truncates the
datetime.

John

"Johnfli" wrote:

> I have a field in my table that is set as DATETIME
>
> The data that gets imported to it is a text file and has teh data with teh
> time.
> for example, 1/1/2006 4:57:12 PM
>
> I want to get rid of teh time part
>
> How can I make it so the data that I already have in the table will drop t
eh
> time??
>
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
John Bell
03-31-06 08:23 AM


Re: drop the time
ummm, hmmmm, ok, so how do I do any of teh items you mentioned???   :)
I have DTS setup as teh text file is ftp'd to us.    Teh time is included in
the text file and teh people sending it to us are not interested in dropping
off teh time portion.





"John Bell" < jbellnewsposts@hotma
il.com> wrote in message
news:CCF11FA2-4E88-4642-8242- AEA7213D590A@microso
ft.com...
> Hi
>
> In a SQL Server datetime field you will always have a time part even if
> you
> don't specify the time it will default to midnight (00:00.000).
>
> You don't say how the data is imported and if that is the only way the
> column gets populated?
>
> If you use DTS to load the data, you could use an activeX transform to
> truncate the datetime field before it is inserted. If you use
> BCP/BULKINSERT
> you can specify a format file that splits off the time and ignores it.
> Another method is to load the data into a staging table and manipulate it
> from there whilst it is being inserted into the final destination. You
> could
> also use an instead of trigger (but you would need to make sure that it
> fires
> for your bulk insert), or possibly have a computed column that truncates
> the
> datetime.
>
> John
>
> "Johnfli" wrote:
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Johnfli
03-31-06 04:23 PM


Re: drop the time
Hi

I assume it is the same DTS package that will load the file?

Check out http://www.sqldts.com/default.aspx?279,4 on how to use the
ActiveX transform. You will need to use the left function on the source
column to just insert the date part.

John

Johnfli  wrote:[color=darkred
]
> ummm, hmmmm, ok, so how do I do any of teh items you mentioned???   :)
> I have DTS setup as teh text file is ftp'd to us.    Teh time is included 
in
> the text file and teh people sending it to us are not interested in droppi
ng
> off teh time portion.
>
>
>
>
>
> "John Bell" < jbellnewsposts@hotma
il.com> wrote in message
> news:CCF11FA2-4E88-4642-8242- AEA7213D590A@microso
ft.com... 


Report this thread to moderator Post Follow-up to this message
Old Post
John Bell
03-31-06 06:23 PM


Re: drop the time
cool, I will give it a shot.
Thank you

"John Bell" < jbellnewsposts@hotma
il.com> wrote in message
news:1143826579.603455.255570@g10g2000cwb.googlegroups.com...
> Hi
>
> I assume it is the same DTS package that will load the file?
>
> Check out http://www.sqldts.com/default.aspx?279,4 on how to use the
> ActiveX transform. You will need to use the left function on the source
> column to just insert the date part.
>
> John
>
> Johnfli wrote: 
>



Report this thread to moderator Post Follow-up to this message
Old Post
Johnfli
03-31-06 06:23 PM


Sponsored Links





Last Thread Next Thread
Post New Thread

MS SQL Server archive

Show a Printable Version Email This Page to Someone! Receive updates to this thread
Microsoft SQL Server
Access database support
PostgreSQL Replication
SQL Server ODBC
FoxPro Support
PostgreSQL pgAdmin
SQL Server Clustering
MySQL ODBC
Web Applications with dBASE
SQL Server CE
MySQL++
Sybase Database Support
MS SQL Full Text Search
PostgreSQL Administration
SQL Anywhere support
DB2 UDB Database
Paradox Database Support
Filemaker Database
Berkley DB
SQL 2000/2000i database
ASE Database
Forum Jump:
All times are GMT. The time now is 08:21 PM.

 
Mobile devices forum | Database support forum archive




Copyrights DropTable.com Database Support Forum 2004 - 2006