Solved

sql server 2008 - Cannot find data type DATE

Posted on 2013-11-07
13
1,768 Views
Last Modified: 2013-11-07
I am using SQL Server 2008. I tried to use the data type date. DECLARE @CurrentDate DATE
I get the error: Parameter or variable '@CurrentDate' has an invalid data type. Why?
0
Comment
Question by:qbjgqbjg
[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
  • 6
  • 3
  • 2
  • +1
13 Comments
 
LVL 66

Expert Comment

by:Jim Horn
ID: 39630453
>Why?
The DATE data type was not introduced until SQL Server 2008 R2.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 39630464
Disregard the above, it was introduced in 2008, not R2.
Show us the full T-SQL, as the error is likely somewhere else in code.
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 39630474
Could you please execute this query and print the result:

SELECT  @@VERSION 

Open in new window

0
Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

 

Author Comment

by:qbjgqbjg
ID: 39630589
I highlighted just the declare and got the error. I ran the SELECT  @@VERSION
It says 2005, but the logon screen says 2008.
0
 

Author Comment

by:qbjgqbjg
ID: 39630594
Microsoft SQL Server 2005 - 9.00.4035.00 (Intel X86)   Nov 24 2008 13:01:59   Copyright (c) 1988-2005 Microsoft Corporation  Standard Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
0
 

Author Comment

by:qbjgqbjg
ID: 39630613
It shows this under about.sql-version.docx
0
 
LVL 5

Accepted Solution

by:
dannygonzalez09 earned 500 total points
ID: 39630685
Could that be because you've multiple instances of SQL servers -SQL 2005 and SQL 2008... you are using SQL 2008 but the database is on SQL 2005?
0
 

Author Comment

by:qbjgqbjg
ID: 39630699
How can I tell?
0
 
LVL 5

Expert Comment

by:dannygonzalez09
ID: 39630712
SELECT @@version should get you the correct information about the SQL instance you are connected to irrespective of what version you are using (version at the log on screen)

for Ex: I am using SQL 2012 to connect to a database running on SQL 2008

@@version gives me the information about SQL 2008 but Help in the tool bar gets me info about the SQL version i'm using

ex
0
 

Author Comment

by:qbjgqbjg
ID: 39630737
So even though I am using 2008, I can't use 2008 features.
0
 
LVL 66

Expert Comment

by:Jim Horn
ID: 39630739
>you are using SQL 2008 but the database is on SQL 2005?
booya ... problem solved.

I'm using SSMS 2012 to go up against 2008R2 databases, and have to remind myself that I can't use the features that are new to 2012 such as LAG, LEAD, BOMONTH, etc.
0
 

Author Closing Comment

by:qbjgqbjg
ID: 39630753
Thanks
0
 
LVL 15

Expert Comment

by:pateljitu
ID: 39630785
You can check "Program and Features" to verify if both SQL 2005 and SQL 2008 are installed on the same machine, I guess that's the case.

To use features of SQL 2008 you will need to re-install SQL 2008 with Named instance and use that named instance to connect to SQL 2008 database.

Please see this video on how to configure SQL 2008 with named instance, once installation is complete connect to the new named instance and that's it.

http://www.youtube.com/watch?v=9oXqzdHUH4A

Good luck
0

Featured Post

Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

Question has a verified solution.

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

     When we have to pass multiple rows of data to SQL Server, the developers either have to send one row at a time or come up with other workarounds to meet requirements like using XML to pass data, which is complex and tedious to use. There is a …
Use this article to create a batch file to backup a Microsoft SQL Server database to a Windows folder.  The folder can be on the local hard drive or on a network share.  This batch file will query the SQL server to get the current date & time and wi…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

623 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