Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Dates in Query analyser - more info

Author  Topic 

Pinto
Aged Yak Warrior

590 Posts

Posted - 2006-04-21 : 06:25:16
I am trying to test sp in Query Analyser as below but get the error

Server: Msg 8114, Level 16, State 4, Procedure spRMU_GetChaseFiles, Line 0
Error converting data type varchar to datetime.

How do I put the date as a parameter ? I think it may be to do with the fact that MaxDateOut is an expression in my view that the sp is based on. It is taking this as char when it should be datetime. So, how do I make this expression type date ?

EXEC spRMU_GetChaseFiles
@strStartDate ='01/01/05',
@strEndDate = '21/04/06',
@strDepartment = 'Central Units',
@strDivision = 'Personnel',
@strSection = ''

Kristen
Test

22859 Posts

Posted - 2006-04-21 : 06:39:22
The only prudent way to put dates in "text strings" is:

'yyyymmdd'

or

'yyyymmdd hh:mm:ss.mmm'

Anything else is open to interpretation and ambiguity of the Locale the machine is set to etc.

Kristen
Go to Top of Page

PSamsig
Constraint Violating Yak Guru

384 Posts

Posted - 2006-04-21 : 13:50:08
Way to go frequent-forum-poster-Kristen-of-whom-I-have-no-personal-knowledge-of-but-whoms-wit-I-acknowledge
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-21 : 20:14:16
quote:
Originally posted by PSamsig

Thats my girl :)





KH


Go to Top of Page

spirit1
Cybernetic Yak Master

11752 Posts

Posted - 2006-04-21 : 21:16:36
now the question remains is he reffereing to Kristen or Pinto??
and which would be weirder??

oh man... i just thought of Kristen in a skirt.... nooooo... go away obnoxious image....
arghhh!!!!!

Go with the flow & have fun! Else fight the flow
Blog thingie: [URL="http://weblogs.sqlteam.com/mladenp"]
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-04-22 : 00:24:20
uhmm... have you two met?



quote:
Originally posted by PSamsig

Thats my girl :)



--------------------
keeping it simple...
Go to Top of Page

PSamsig
Constraint Violating Yak Guru

384 Posts

Posted - 2006-04-22 : 07:06:39
Sigh you guys, I was just refereing to an other post of mine, where I refered to the danger of using literal dates in none portable formats, they are disasters waiting to happen, which this thread is all about, and Kirsten just happen to know that. But I guess I next time will write 'Way to go frequent-forum-poster-Kirsten-of-whom-I-have-no-personal-knowledge-of-but-whoms-wit-I-acknowledgement'
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-22 : 09:02:12
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-04-23 : 21:11:55
just a smile eh Kristen?
How many times now?


quote:
Originally posted by Kristen





--------------------
keeping it simple...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-23 : 23:08:43
Can't blame those who mistaken. See here



KH


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-24 : 01:40:42
quote:
Originally posted by jen

How many times now?

--------------------
keeping it simple...


As many times as possible

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-24 : 04:46:20
"Can't blame those who mistaken. See here"

Can't blame you for being insular, living on a small island, but you're being subverted by those even-more-insular Americans

Some slightly more "global" research is at:

http://www.sqlteam.com/forums/topic.asp?TOPIC_ID=56120&SearchTerms=spelling+and+gender+of+Kristen

Kristen
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-24 : 05:07:22
select Soundex('Kristen') as Kristen ,Soundex('Kristin') as Kristin

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-24 : 05:09:42
select WhatSex('Kristen') as Kristen, WhatSex('Kristin') as Kristin


Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-04-24 : 05:13:01
quote:
Originally posted by Kristen

select WhatSex('Kristen') as Kristen, WhatSex('Kristin') as Kristin





Server: Msg 195, Level 15, State 10, Line 1
'WhatSex' is not a recognized function name.



Madhivanan

Failing to plan is Planning to fail
Go to Top of Page

PSamsig
Constraint Violating Yak Guru

384 Posts

Posted - 2006-04-24 : 05:35:26
I guess it isn't much conciliation that I apparently is slightly dyslexic, I had read Kristen as Kirsten ... ... but anyway, I have edited my original post.
Go to Top of Page

Kristen
Test

22859 Posts

Posted - 2006-04-24 : 15:20:13
"Server: Msg 195, Level 15, State 10, Line 1
'WhatSex' is not a recognized function name.
"

Madhi, you need the SQL Adult Version!

"I apparently is slightly dyslexic"

So how come you can spell "dyslexic" then, eh?

Don't sweat it ...

Kristen
Go to Top of Page

PSamsig
Constraint Violating Yak Guru

384 Posts

Posted - 2006-04-24 : 15:30:59
LOL, I looked it up in a dictionary :)
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2006-04-24 : 15:55:44
There are two sides to every story:
http://www.banned-width.com/shel/works/boysue.html
http://www.banned-width.com/shel/works/boysuepa.html





CODO ERGO SUM
Go to Top of Page

jen
Master Smack Fu Yak Hacker

4110 Posts

Posted - 2006-04-24 : 20:58:50
that's just...

--------------------
keeping it simple...
Go to Top of Page

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2006-04-25 : 03:01:13
"Madhi, you need the SQL Adult Version!"
Is this 2000 or 2005 ?

Damn! I am still using 2000 and yet to move on to 2005 and now there is another version !



KH


Go to Top of Page
    Next Page

- Advertisement -