Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8375823
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T15:16:32+00:00 2026-06-09T15:16:32+00:00

Using SQL Server 2012, and the new date type (not dateTime) I created the

  • 0

Using SQL Server 2012, and the new date type (not dateTime) I created the next procedure:

CREATE PROC Test(@StartDate date ,@EndDate date)    
AS    
DECLARE @Temp TABLE([ID] int, [Date] date)    
INSERT INTO @Temp SELECT 1, CONVERT(date,'31/12/2012',103)    
INSERT INTO @Temp SELECT 2, CONVERT(date,'01/10/2012',103)    
INSERT INTO @Temp SELECT 3, CONVERT(date,'01/01/2012',103)    
SELECT * FROM @Temp WHERE [Date] BETWEEN @StartDate AND @EndDate

When I run this stored procedure I get the next error indicating the date format of the parameter:

Incorrect syntax near '/'. 

Please what should be done ?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T15:16:34+00:00Added an answer on June 9, 2026 at 3:16 pm

    For one, your date shouldn’t have a / in it. But it also needs to be enclosed in quotes. Try:

    EXEC dbo.Test @StartDate = '20120101', @EndDate = '20120131';
    

    The reason it needs to be enclosed in quotes is, if you don’t use quotes, your “date” is interpreted as a mathematical expression, e.g.:

    01/01/2012 = 1 divided by 1 divided by 2012
    

    The reason your date shouldn’t have a / in it is because m/d/y and d/m/y are unsafe formats that can be interpreted differently depending on language and other settings.

    And finally, if you are calling this procedure from C#, why are you passing strings and not properly typed parameters?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Using SQL Server 2005 Table1 Date 19-12-2009 20-12-2010 ..... Date Column datatype is DATETIME
Im using sql server 2012 and transactional replication. For replication security, I created a
Im using sql server 2012 and its replication feature. Here im trying to manually
I'm using SQL Server 2012 and trying to implement transactional replication. Im using the
I am using a JDBC driver for Microsoft SQL Server 2012 (sqljdbc_4.0) and although
We have an issue upgrading to SQL Server 2012. I am using the following
Using SQL Server 2000 Table PersonID Date 001 11-02-2009 002 11-02-2009 003 11-02-2009 001
I'm new to using SQL Server 2008 DB Project's in VS 2010. I found
I am using SQL Server 2012 RC0 + EF 4 + MVC 4. 90%
Im kinda new to SQL Server and am using the 2005 version. What I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.