Click here to monitor SSC
SQLServerCentral is supported by Redgate
 
Log in  ::  Register  ::  Not logged in
 
 
 


BCP Help


BCP Help

Author
Message
Erland Sommarskog
Erland Sommarskog
SSC Eights!
SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)

Group: General Forum Members
Points: 937 Visits: 866
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
jerome.morris
jerome.morris
SSC-Enthusiastic
SSC-Enthusiastic (147 reputation)SSC-Enthusiastic (147 reputation)SSC-Enthusiastic (147 reputation)SSC-Enthusiastic (147 reputation)SSC-Enthusiastic (147 reputation)SSC-Enthusiastic (147 reputation)SSC-Enthusiastic (147 reputation)SSC-Enthusiastic (147 reputation)

Group: General Forum Members
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
Jeff Moden
Jeff Moden
SSC-Forever
SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)SSC-Forever (45K reputation)

Group: General Forum Members
Points: 45127 Visits: 39923
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.
Although they tell us that they want it real bad, our primary goal is to ensure that we dont actually give it to them that way.
Although change is inevitable, change for the better is not.
Just because you can do something in PowerShell, doesnt mean you should. Wink

Helpful Links:
How to post code problems
How to post performance problems
Forum FAQs
Erland Sommarskog
Erland Sommarskog
SSC Eights!
SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)SSC Eights! (937 reputation)

Group: General Forum Members
Points: 937 Visits: 866
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
Go


Permissions

You can't post new topics.
You can't post topic replies.
You can't post new polls.
You can't post replies to polls.
You can't edit your own topics.
You can't delete your own topics.
You can't edit other topics.
You can't delete other topics.
You can't edit your own posts.
You can't edit other posts.
You can't delete your own posts.
You can't delete other posts.
You can't post events.
You can't edit your own events.
You can't edit other events.
You can't delete your own events.
You can't delete other events.
You can't send private messages.
You can't send emails.
You can read topics.
You can't vote in polls.
You can't upload attachments.
You can download attachments.
You can't post HTML code.
You can't edit HTML code.
You can't post IFCode.
You can't post JavaScript.
You can post emoticons.
You can't post or upload images.

Select a forum

































































































































































SQLServerCentral


Search