Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Problems Microsoft SQL 2005

Posted on 2012-03-29
18
Medium Priority
?
372 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
Prepare for your VMware VCP6-DCV exam.

Josh Coen and Jason Langer have prepared the latest edition of VCP study guide. Both authors have been working in the IT field for more than a decade, and both hold VMware certifications. This 163-page guide covers all 10 of the exam blueprint sections.

 
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

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

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

In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
An alternative to the "For XML" way of pivoting and concatenating result sets into strings, and an easy introduction to "common table expressions" (CTEs). Being someone who is always looking for alternatives to "work your data", I came across this …
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

715 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