473,324 Members | 2,248 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,324 software developers and data experts.

Search Criteria

Can you help me out please !
This is a search Stored procedure that returns the list .of patients .i want to include the start and end date in the search criteria
So you will need to accept the startDate and endDate

parameters to this storedprocedure
the end date is the current date
the start date is the origination date - 1 year
So your search criteria will return list patients whose creation date

is within the startDate and the endDate.


thanks in advance
Oct 2 '07 #1
4 1774
Can you help me out please !
This is a search Stored procedure that returns the list .of patients .i want to include the start and end date in the search criteria
So you will need to accept the startDate and endDate

parameters to this storedprocedure
the end date is the current date
the start date is the origination date - 1 year
So your search criteria will return list patients whose creation date

is within the startDate and the endDate.


thanks in advance
i have written this as
Declare
@Startdate as Datetime,

@Enddate as Datetime


BEGIN
SET NOCOUNT ON

Startdate = DateDiff(getdate(),OriginationDate,1)

Enddate = getdate()

Select CCRid from CC_Engineering with(nolock) Where Origination_date between Startdate and Enddate
SET NOCOUNT OFF
END
Oct 2 '07 #2
ck9663
2,878 Expert 2GB
i have written this as
Declare
@Startdate as Datetime,

@Enddate as Datetime


BEGIN
SET NOCOUNT ON

Startdate = DateDiff(getdate(),OriginationDate,1)

Enddate = getdate()

Select CCRid from CC_Engineering with(nolock) Where Origination_date between Startdate and Enddate
SET NOCOUNT OFF
END
if you need the user to pass the value of those variable you need a function that returns a table.

assuming your query is correct, it should go something like this

Expand|Select|Wrap|Line Numbers
  1. CREATE FUNCTION returnvalidrecords(  
  2. @Startdate Datetime, @Enddate Datetime
  3.  )
  4. RETURNS TABLE
  5. AS
  6. RETURN (
  7. Select CCRid from CC_Engineering with(nolock) Where  Origination_date between  @Startdate and @Enddate
  8. )
  9. Go
Oct 2 '07 #3
if you need the user to pass the value of those variable you need a function that returns a table.

assuming your query is correct, it should go something like this

Expand|Select|Wrap|Line Numbers
  1. CREATE FUNCTION returnvalidrecords(  
  2. @Startdate Datetime, @Enddate Datetime
  3.  )
  4. RETURNS TABLE
  5. AS
  6. RETURN (
  7. Select CCRid from CC_Engineering with(nolock) Where  Origination_date between  @Startdate and @Enddate
  8. )
  9. Go


yea but the difference of the startdate should be records which r created past one year only ...so the how to write the start date .....ie is origination_date-getdate = 1 .......i had written in the above reply......but i m gettin an error ..how do i solve it
thanks in advance
Oct 2 '07 #4
ck9663
2,878 Expert 2GB
yea but the difference of the startdate should be records which r created past one year only ...so the how to write the start date .....ie is origination_date-getdate = 1 .......i had written in the above reply......but i m gettin an error ..how do i solve it
thanks in advance
try something like
Expand|Select|Wrap|Line Numbers
  1. select * from myTable
  2. where createdate between getdate() and dateadd(mm,-12, getdate())
  3.  
  4.  
Oct 3 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: N. Graves | last post by:
Hi, I want to have a Search Dialog box that has several text box and fields to build a search and display the results in a form. I can do everything that I need to if I us a report but I would...
4
by: Jan | last post by:
I am having problems trying to print a report based on a form. This is a search form only, no data input. There is a query that the form looks at, but then there are numerous comboxes that you...
4
by: Gobi | last post by:
Hello, I have a Database with lists of Clients in each. Every year a new tables is created with the naming convention "CloseYear" ie close1999, close2000 There are tables from this year back to...
3
by: Russell | last post by:
Hey, ok i have numerous tables to search through for a 'site search'. some of the searchble fields have html embeded within so after some quick referencing, saw I can use the regExp function...
31
by: DWolff | last post by:
I'm somewhat new to Access, and have no VB experience at all (except for modifying existing code where obvious). I built a data entry form that works fine. Typically, a client will call in and...
6
by: shantanu | last post by:
Hi All, I have a requirement to develop a search engine based on some search criteria that will search for the string or statement in all the documents uploaded in the website. The search result...
4
by: bendlam | last post by:
I have a page that contains search criteria and when you click on the search button it causes a post back that populates a dataview on the same page. One of the gridview columns contains a link...
49
by: martin DH | last post by:
Hello all, I'm back with another SQL related problem. The details are below, but in short: I am using Access 2003. I have a table whose structure may include four different associate names per...
13
by: Robertf987 | last post by:
Hi, Yet another thing I need help with I'm affraid. I'll first explain what I want, then I'll try to explain what I have. I'm using Microsoft Access 2000. What I want is to be able to do a...
2
by: MNNovice | last post by:
I am working on a database on my CD collection using Access 2003. Some of the table structures are given below. Table 1 tblMusicCategory Field 1: MusicCategoryID - Auto Number (PK) Field 2:...
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
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
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...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
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: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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.