Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase «««123

BCP Help Expand / Collapse
Author
Message
Posted Wednesday, August 21, 2013 3:23 PM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 1:20 PM
Points: 807, Visits: 725
So why don't acquire those skills by rolling up your sleeves and start working. My examples in http://www.sommarskog.se/arrays-in-sql-2008.html should take you some part of the way.

I mean, your skills does not seem to suffice for the solution you are looking at current, and which is immensly more complex to mantain.


Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Post #1486975
Posted Wednesday, August 21, 2013 4:57 PM
SSC-Enthusiastic

SSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-EnthusiasticSSC-Enthusiastic

Group: General Forum Members
Last Login: Wednesday, March 19, 2014 3:01 AM
Points: 147, Visits: 161
Ok, I will look at this, but entertain me

insert [dbo].[AlarmDet]
(JobStart)
select
--convert (Jobsatrt (),101)
--SELECT convert(datetime, '23/07/2009', 103)
--convert (datetime, Jobstart,103)
--CONVERT(varchar, CONVERT(datetime, JobStart), 100)


--cast(JobStart as date)
from [SLADB].[dbo].[AlarmDetTest]


How do I get this to work ? I know the format is M/d/yyyyHH:mm:ss

Thanks

Jay
Post #1486995
Posted Wednesday, August 21, 2013 7:44 PM


SSC-Dedicated

SSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-DedicatedSSC-Dedicated

Group: General Forum Members
Last Login: 2 days ago @ 1:53 PM
Points: 35,366, Visits: 31,905
jerome.morris (8/21/2013)
Ok, I will look at this, but entertain me

insert [dbo].[AlarmDet]
(JobStart)
select
--convert (Jobsatrt (),101)
--SELECT convert(datetime, '23/07/2009', 103)
--convert (datetime, Jobstart,103)
--CONVERT(varchar, CONVERT(datetime, JobStart), 100)


--cast(JobStart as date)
from [SLADB].[dbo].[AlarmDetTest]


How do I get this to work ? I know the format is M/d/yyyyHH:mm:ss

Thanks

Jay

Apologies for losing track of this post.

Can you post some of the rows you currently have in the AlarmDetTest table so we can work with the actual formats you currently have? If you can post 10 or so rows of the data from that staging table in a readily consumable format, I know we can help. Please see the first link in my signature line below for what I mean by "readily consumable" format and how to make it.


--Jeff Moden
"RBAR is pronounced "ree-bar" and is a "Modenism" for "Row-By-Agonizing-Row".

First step towards the paradigm shift of writing Set Based code:
Stop thinking about what you want to do to a row... think, instead, of what you want to do to a column."

(play on words) "Just because you CAN do something in T-SQL, doesn't mean you SHOULDN'T." --22 Aug 2013

Helpful Links:
How to post code problems
How to post performance problems
Post #1487023
Posted Thursday, August 22, 2013 12:29 AM


SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: 2 days ago @ 1:20 PM
Points: 807, Visits: 725
jerome.morris (8/21/2013)
How do I get this to work ? I know the format is M/d/yyyyHH:mm:ss


You think you know. Unless the file is produced by a device, it is almost given that there are bad dates in the data.

Let's, you need to get a space in there, and then you can use convert with the correct format code (which you find in Books Online). The problem is getting the space in there. Hm, something like:

substring(col, 1, charindex('/', col) + 4) + ' ' + substring(col, charindex('/', col) + 5, len(substring))

Something like that. I did not test, I leave that to you. But those are the building blocks. Again, use Books Online to learn more about these functions.



Erland Sommarskog, SQL Server MVP, www.sommarskog.se
Post #1487072
« Prev Topic | Next Topic »

Add to briefcase «««123

Permissions Expand / Collapse