473,327 Members | 2,025 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,327 software developers and data experts.

Stored procedure date question

The following is part of my stored procedure where I could use some help:
If I remark out the two lines regarding dates, it runs fine. The date
parameter is passed from a VB app as a text value in the format mm/dd/yy.

Thanks for any help.
Charlie
SELECT * FROM dbo.TWQRHISTEARDOWN_HEADER where

(WQR_TDH_MODELYEAR_T=@Model_Year OR @Model_Year IS NULL)

AND (WQR_TDH_OFFLINEDT_Y>=@Start_Date OR @Start_Date IS NULL)

AND (WQR_TDH_OFFLINEDT_Y<=@Stop_Date OR @Stop_Date IS NULL)
Dec 16 '07 #1
1 1351
You didn't mention the specifics of the problem you are having (i.e. error
message, unexpected results).
The date parameter is passed from a VB app as a text value in the format
mm/dd/yy.
I suggest you use neutral DATAFORMAT literal strings ('YYYYMMDD' or
'YYYY-MM-DDTHH:MM:SS'). A better method here is to use parameterized SQL
statements in your VB code so that you don't need to be concerned with
formatting date strings or doubling up quotes in text strings.

--
Hope this helps.

Dan Guzman
SQL Server MVP

"Charlie" <ja******@yahoo.comwrote in message
news:47**********************@roadrunner.com...
The following is part of my stored procedure where I could use some help:
If I remark out the two lines regarding dates, it runs fine. The date
parameter is passed from a VB app as a text value in the format mm/dd/yy.

Thanks for any help.
Charlie
SELECT * FROM dbo.TWQRHISTEARDOWN_HEADER where

(WQR_TDH_MODELYEAR_T=@Model_Year OR @Model_Year IS NULL)

AND (WQR_TDH_OFFLINEDT_Y>=@Start_Date OR @Start_Date IS NULL)

AND (WQR_TDH_OFFLINEDT_Y<=@Stop_Date OR @Stop_Date IS NULL)

Dec 17 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: mhk | last post by:
Hi, i have "req_date" column of "datetime" type in Database table besides other columns. From my Web page, i am calling the Stored Procedure with variable parameter "Search_Date" of...
7
by: Anthony Robinson | last post by:
Have been encountering an odd issue. Every now and again, certain packages of stored procedures just become invalid. I'm aware that dropping or altering an underlying table would render a package...
2
by: Dino L. | last post by:
How can I run stored procedure (MSSQL) ?
2
by: Woody Splawn | last post by:
I am using SQL Server 2000 as the back-end. I have created a stored procedure in SQL server called usp_AddContract. This Stored procedure inserts a new contract into a contracts table. I have...
12
by: Bill Nguyen | last post by:
What's the VB syntax to run the CR report using the following SP? I use CrystalreportViewer and ReportDocument. Thanks Bill Here's the SP in SQLserver 2K: CREATE proc mysp_ReportSubmission...
22
by: M K | last post by:
Heres my SP: ( i am trying to add more than 1 field but get the same error no matter how many i try to add, i thought i would try to insert the primary key only and work up from there but the...
2
by: syntego | last post by:
We commonly use triggers to log changes to our main tables to historical log tables. In the trigger, we create a concatenated string of the old values by casting them as follows: ...
2
by: Piotrek \Alchemik\ | last post by:
Hello, i'm trying to call stored procedure like: ALTER PROCEDURE . @p1 int, @p2 Datetime AS BEGIN SET NOCOUNT ON;
1
by: peaceburn | last post by:
Hi, I'm gonna pull my hair in the coming days with these DB2 stored procedures. So the issue, let's assume a simple stored procedure like this : CREATE PROCEDURE MYSCHEMA.PROCEDURE1 ( )...
1
by: brianlanning | last post by:
We have a stored procedure that we've tried with two slightly different designs. It needs to take a 30 day date range and return a result set. Design 1 takes one date as a parameter. The other...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.