Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Problems Microsoft SQL 2005

Posted on 2012-03-29
18
Medium Priority
?
373 Views
Last Modified: 2012-04-06
We have a situation when a PC connects to the Ms SQL instance, that it would halt a specific areas and the message that appears is "data type error.

What can be causing this?
0
Comment
Question by:rayluvs
18 Comments
 

Author Comment

by:rayluvs
ID: 37782483
Ooops, wrong error message.  Tha message is:

Msg 242, Level 16, State 3, Line 3
The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

Open in new window


When debuging the VB.NET apps we see the error happens in the line where the script is:

SET @Var = (SELECT CONVERT(VARCHAR,GETDATE(),103))

Open in new window


We noticed that the Server is Ms SQL 2005 English version, but another server is Spanish version and it runs ok.  We also noticed that doing the query directly in the Studio SQL, gave same result in 2005 SQL version.

We tested other values beside 103 and it works.  We thought it was Regional, but changed it, still error.

Please adveice
0
 
LVL 15

Expert Comment

by:Anuj
ID: 37782523
0
 
LVL 8

Assisted Solution

by:gpizzuto
gpizzuto earned 400 total points
ID: 37782591
did you declare the variable  @Var
as
nvarchar (at least 10) ???

try also

SELECT CONVERT(VARCHAR(10),GETDATE(),103)
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 83

Accepted Solution

by:
CodeCruiser earned 1600 total points
ID: 37782825
Try changing

SET @Var = (SELECT CONVERT(VARCHAR,GETDATE(),103))

to

SET @Var = (SELECT CONVERT(VARCHAR,Convert(DateTime, GETDATE(), 103),103))
0
 

Author Comment

by:rayluvs
ID: 37793556
It did work.  Question, can this be an issue as I the install parameters of the SQL instance?
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37795714
>It did work.
My suggestion?

>Question, can this be an issue as I the install parameters of the SQL instance?
Not sure what you mean.
0
 

Author Comment

by:rayluvs
ID: 37795955
All suggestions worked.

What we mean by "if this can be a SQL instance issue", is since in server SQL 2000 worked excellently and in the 2005 didnt.  So can it be the actual installation?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1600 total points
ID: 37796071
I think it has to do with culture settings.
0
 

Author Comment

by:rayluvs
ID: 37796355
what is "culture"
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1600 total points
ID: 37796413
Regional and culture settings of the system/server. Dates have different format in different cultures like dd/mm/yyyy in UK vs mm/dd/yyyy in US.
0
 

Author Comment

by:rayluvs
ID: 37796450
Understood.

One last question; if truly based on "culture settings", should we reinstall SQL?
0
 
LVL 83

Assisted Solution

by:CodeCruiser
CodeCruiser earned 1600 total points
ID: 37797073
What are regional settings of the operating systems running the sql servers?

http://stackoverflow.com/questions/2432185/how-can-i-query-the-database-culture-sql-server-2005
0
 

Author Comment

by:rayluvs
ID: 37799543
Thanx, good link.

Should we reinstall SQL or just modify the script as recommended?
0
 

Author Comment

by:rayluvs
ID: 37799546
or change collation?

which?

Please advice.
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37802111
Change script is a quick fix. Other fixes would need more investigation. Do you have a DBA?
0
 

Author Comment

by:rayluvs
ID: 37802267
Don't understand by change script and quick script.  We would to just a simple SELECT various time within MsAccess SQL scripting area.

All googles searches has indicated that it not possible so this where we rely on EE expert advice.

No, we don't have a DBA
0
 
LVL 83

Expert Comment

by:CodeCruiser
ID: 37803200
>Don't understand by change script and quick script.  We would to just a simple SELECT various time within MsAccess SQL scripting area

Your question was whether you should change the select statement, reinstall sql, or change collation. My response was that changing the select statement (sql script) is a quick fix if its working. Reinstalling and changing collation is also an option.
0
 

Author Comment

by:rayluvs
ID: 37817359
Thanx
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.

886 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question