Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server & have generously sponsored dedicated servers and web hosting to ensure a reliable and scalable dedicated hosting solution for

Getting Data Between Two Dates

I am trying to get data from an SQL database only between today's date and 45 days from today's date (or just two dates in general).

Is there a simple code in VB for doing this?


View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
SQL Query For Data Between 2 Dates
 Can anyone please assist me in getting the following SQL Query to work. It returns no errors but also returns no records even though there is actually data in my database for that period.
Dim DCriteria as StringDCriteria = "StartDate <= " & EDateDCriteria = DCriteria & " AND EndDate >= " & SDatestrSQL = "SELECT * FROM vwLeavePlan WHERE " & DCriteria
This results in the follwoing SQL Statement:
strSQL = SELECT * FROM vwLeavePlan WHERE StartDate <= 31/05/2005 AND EndDate >= 01/05/2005

View Replies !   View Related
Data Retreival Between Two Dates

Can anyone tell me the exact syntax for data retrieval from a remote datasource with dates? This is what I tried and it didn't work

SELECT * FROM [remote datasource TABLE_NAME]
WHERE [COLUMN_NAME] BETWEEN '01-JAN-1988 00:00:00.00' AND '01-JAN-1989 00:00:00.00'

It was giving an error saying illegal character.
Can anyone help me please?

Thank You.


View Replies !   View Related
Selecting Data Using A Range Of Dates
For some reason this is just not "clicking" with me and the longer I stare at it the more I overcomplicate things and then I just confuse myself further...

Provided this relation showing where "pkey" and "skey" met on "ServiceDate":


skey pkey ServiceDate
123 1 11/12/2005
124 1 10/12/2005 *
123 2 10/02/2005
124 2 10/12/2005
124 2 11/12/2005
123 2 11/02/2005

I need to select out a list of distinct pkeys and skeys only when there was no meeting between the two in November 2005. In other words, this query would produce only one record - the starred record - when run against this sample table. This is because even though, for example, skey 124 / pkey 2 has an entry outside the desired range, it also has one inside the desired range. The same goes for the record outside our range for 123 and 2 - it also has a record inside our range.

At this point, I've come to the conclusion that I can first select all the distinct pkeys and skeys where the servicedate is not in 11/2005 then join it to a selection of distinct pkeys and skeys where the servicedate IS in the desired date range. Does that seem like the most straightforward way through this?

I don't get the impression that this is that complicated a problem, but it's one of those deals where I goofed up somewhere along the line, and now I think I'm really overthinking the problem, so I'd be much obliged if someone could give me a hearty slap to clear the ol' noggin.

View Replies !   View Related
Want To Use Parameters To Filter For Dates Between Two (parameter, User-input) Dates
SQL 2005 Dev

How can I do this with Parameters? I can get a single parameter to filter for a single date (or even a combo list of the dates in DB). But I want my parameters to interact so that they specify a range. Is this possible?

View Replies !   View Related
Problem In Retreivinng Data Between Two Dates In Sql Server
HI friends,
I have a problem with sql server. I know that i should not discuss my problem in this forum.
But the problem is demanding me to place it anywhere.
The problem is i want to retreive data from a table between two dates.
I have written the query as below.
"select * from employees where hiredate between 01-05-1992 and 15-11-1994"
But it is returning 0 rows.If anybody helps me in this issue it willbe helpful me..
Note: I have tried by changing all the date formats like DMY,MDY,YMD..........
Thanks N Regards,
Vallamreddy VenuGopal

View Replies !   View Related
Inconsistant Row Counts When Selecting Data By Dates HELP!

I currently think Im going mad!!

I have a large table (2+Million records, 2000+ new per day). If I want to count the records in one month, I could do :-

Select Count(*) from Table1 where Added_Date between '1999-12-01'
and '1999-12-31'


Select Count(*) from Table1 where Added_Date >= '1999-12-01' and
Added_Date <= '1999-12-31'

For these two above, I get the same result.


If I then do:-

Select Count(*) from Table1 where Added_Date between '1999-12-01 00:00:00'
and '1999-12-31 23:59:59'
or use the >= and <= operators, the result is larger.

If I then do :-

Select Count(*) from Table1 where Added_Date between '1999-12-01 00:00:00.000' and '1999-12-31 23:59:59.999'
or use the >= and <= operators, the result is larger still but i believe this including more rows than there actually is?.

I can get over the problem programatically using Convert to truncate to a day, month or year however, I don't understand why the results are different.

Any Ideas as to why this is happening, A'm I being stupid!!!!!!!

(PS Added_Date has a non_clustered index which has been rebuilt twice and DBCC finds no errors)

Many thanks,

Peter Farley

View Replies !   View Related
Problems Converting Dates As Varchar To Datetime Data Type

Hi all,

I need to migrate from a DB with a column containing dates as varchar to a new DB which will have a column with the same content as the source DB but in datetime format.

I have tried to use the cast function but i always get a message saying that the conversion result in an out of range error.

Someone can help me? PLEASE


View Replies !   View Related
Comparing Dates With Today Dates
I want to know if there is a way to compare dates in the sql statement with dates that I input into a database and todays date.  the datatype that I'm using is smalldatetime.The statement I used is:Select Date from Table where Date > ''I get an errorCould this be done or is there another approach?

View Replies !   View Related
Generate Dates Between Two Dates

I have a table which records employees'time-off records. There are 6 columns in this TimeOff table. They are RequestID, EmpName, StartDate, EndDate, Type, NumofDays. I have another table which has all the dates from 01/01/1950 to 01/01/2056.

I am trying write a query which lists all the dates between the timeoff startdate and enddate, including the the start and end dates, but my query so far only lists the start and end date in a timeoff record:

SELECT D.[Date], Datename(dw,D.[Date]) AS Weekday
FROM Dates D LEFT JOIN TimeOff T ON D.[Date] = T.OffStartDate OR D.[Date] = T.OffEndDate
WHERE (OffType = 'Sick Day' AND EmpName = 'Cat White') AND (D.[Date] BETWEEN T.StartDate AND T.EndDate)

Any advice will be greatly appreciated!

View Replies !   View Related
Getting Individual Dates Between 2 Dates
Has anyone ever written a function to retrieve all individual dates between two given dates? Using DATEDIFF I can get the number of days between two dates. However I need to iterate through the days to identify weekend and holiday dates. Has anyone ever written a function to do this?

So, if select datediff(d,'07/01/2007','07/15/2007') as NumOfDays returns 14, I'd need to iterate through the 14 days and get theweekendsand holidays. Would I have to use a cursor to iterate through the days?

View Replies !   View Related
Leap Year Dates Causing Error When You Pull Dates For Non Leap Year

I'm trying to generate this query, that displays Budget Current Year , Actual Current Year and Prior Year Revenue. When It comes to the Budget and Actual everything works fine, however when I try to add the query for the Prior Year I get an error, and I realized that the leap date is causing the error

Here is what I'm trying to generate






Here is the error that I'm getting:

Code Snippet

Msg 242, Level 16, State 3, Line 1

The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.

(4834 row(s) affected)

Here is my Transact-SQL Syntax (summarized becauseI Couldn't post it):


(CASE WHEN (CASE WHEN dbo.Trans.Tr_Dept = '10' AND dbo.Trans.TR_Main = '5120' AND dbo.Trans.tR_sub = '01'

AND Year(dbo.Trans.TR_Date) = Year(dbo.CurrentDate.CurrDate) AND dbo.trans.Datatype = '1'


(SELECT Trans1.TR_Amount

FROM dbo.Trans Trans1

WHERE Trans1.TR_Dept = '10' AND TR_Main = '5120' AND TR_Sub = '01' AND trans1.TR_Date = CAST((CAST(Month(dbo.Trans.TR_Date)

AS varchar(2)) + '/' + CAST(Day(dbo.Trans.TR_Date) AS varchar(2)) + '/' + CAST(Year(dbo.CurrentDate.CurrDate) AS varchar(4))) AS datetime)

AND Trans1.TR_Entity = dbo.Trans.TR_Entity AND trans1.datatype = dbo.Trans.DataType) ELSE NULL END) * - 1 AS BARmRev,

--AA Script Here AS AARmRev,

(CASE WHEN (CASE WHEN dbo.Trans.Tr_Dept = '10' AND dbo.Trans.TR_Main = '5120' AND dbo.Trans.tR_sub = '01' AND Year(dbo.Trans.TR_Date)

= Year(dbo.CurrentDate.CurrDate) AND dbo.trans.Datatype = '1' THEN dbo.trans.Tr_Amount ELSE NULL END) IS NOT NULL THEN

(SELECT SUM(Trans1.TR_Amount)

FROM dbo.Trans Trans1

WHERE RIGHT(RTRIM(Trans1.TR_Dept), 2) = '10' AND Trans1.TR_Main = '5120' AND Trans1.TR_Sub NOT BETWEEN '04' AND '05' AND

trans1.TR_Date = CAST((CAST(Month(dbo.Trans.TR_Date) AS varchar(2)) + '/' + CAST(Day(dbo.Trans.TR_Date) AS varchar(2))

+ '/' + CAST(Year(dbo.CurrentDate.CurrDate)-1 AS varchar(4))) AS datetime) AND Trans1.TR_Entity = dbo.Trans.TR_Entity AND

trans1.datatype = '0') ELSE NULL END) * - 1 AS PYRmRev


dbo.Trans ON dbo.EntityDef.ED_Property_ID = dbo.Trans.TR_Entity INNER JOIN

dbo.CurrentDate INNER JOIN

dbo.DimTime ON YEAR(dbo.DimTime.TimeDate) = YEAR(dbo.CurrentDate.CurrDate) ON dbo.Trans.TR_Date = dbo.DimTime.TimeDate

WHERE (dbo.EntityDef.ED_Property_ID = 'ADDIS')

ORDER BY dbo.EntityDef.ED_Property_ID, dbo.DimTime.TimeDate

I appreciate all your help


View Replies !   View Related
Sql Dates
Hello All,
 I am trying to Add certain number of days to a particular date.
and my requirement is that it need to exclude all saturdays and sundays and then give me the resultant date in Sqlserver.
 Please can anyone help me in achieving it.
Shiva Kumar

View Replies !   View Related
Set Of Dates
I've got a table (TYPE, DAYMTH) where it is a compound key and theDAYMTH is a datetime but all years are 1900 ONLY THE day and month aresignificant.What I want to do is for each type, find the next n dates - so forexample:TYPE DAYMTH1 1900-02-201 1900-05-051 1900-09-141 1900-11-112 1900-03-032 1900-07-07if I want to get the next 3 dates after 22 June 2005 it should give me:1 2005-09-141 2005-11-111 2006-02-202 2005-07-072 2006-03-032 2006-07-07so, anyone got any bright ideas?I've started down this route:create table #year (yr int)insert into #year values(2005)insert into #year values(2006)insert into #year values(2007)insert into #year values(2008)select *,convert(datetime,convert(varchar,yr) +substring(convert(varchar,daymth,20),5,20),20)from DAYMTHtable,#yearwhere convert(datetime,convert(varchar,yr) +substring(convert(varchar,daymth,20),5,20),20) > getdate()order by type,convert(datetime,convert(varchar,yr) +substring(convert(varchar,daymth,20),5,20),20)and although this seems to be a good start I wonder if there are bettersolutions. Also any quick ideas on how to finish if I decide to followmy existing thought process?thanksPhil

View Replies !   View Related
SQL Between Dates
For some reason guys my SQL string isn't working and I'm probably doingsomething stupid?SELECT *FROM sol_sessionSELECT *FROM SOL_SessionWHERE DateGiven '10/09/2006' AND <'13/09/2006'The 'DateGiven' field is a DateTime field, and I can't see quite whatswrong??I simply get a Syntax error!Cheers, Ash

View Replies !   View Related
ISO Dates?
To support an application, I am integrating it with with Sqlserver2000. The task is simple: get the data at regular intervals, andwrite it into a table dedicated for that application. One of thefields I receive is a date, and it is formatted as an ISO date. Asample value looks like this: "2004-07-09-".SQLServer doesn't support this date format, though. The closest Ihave found is the style code "21" or "121" which accepts input as"yyyy-mm-dd hh:mi:ss.mmm". I have looked at using several replace()and convert() calls but no solution yet.Is there a way to transform the data to conform to this style acceptedby Sqlserver? I would like to do this in the INSERT statement itselfand not have to code application logic (i.e., user-defined function,etc.) for it.

View Replies !   View Related
Help! Dates And SQL
HiI would like to create a SP where it will populate TableA based from TableB.TableB will be populated on a monthly basis using a DTS and within that Iwould like to run the SP to populate TableA.Can someone here please help me create the sql statements as a startingpoint.TIA!BobTableB (source)from_date to_date curr_code ex_rate1/1/2004 1/10/2004 CAD .750001/11/2004 1/16/2004 CAD .743211/17/2004 2/4/2004 CAD .722222/5/2004 2/20/2004 CAD .711112/21/2004 2/28/2004 CAD .778883/1/2004 3/3/2004 CAD .790023/4/2004 3/14/2004 CAD .768033/15/2004 3/23/2004 CAD .700223/24/2004 4/2/2004 CAD .73365etc...TableA (destination):date curr_code ex_rate1/2004 CAD 0.738477 calculation:(.75000+..74321+.72222) / 32/2004 CAD 0.737403(.72222+.71111+.77888) / 33/2004 CAD 0.74798(.79002+.76803+.70022+.73365) / 4etc..

View Replies !   View Related
Dates For The UK
We are deploying a system in the UK in SQL Server 6.5. They want the date to default to dd/mm/yy. Is there a way to set this on a permanent basis? Is there a way to set the server so any time a date is display, including getdate(), the result is dd/mm/yy?

View Replies !   View Related
Dates Between 2 Other Dates
Hi All

I have a table which contains apart from other fields, 2 dates. i.e. startdate and enddate.

The startdate is always less than / equal to enddate.

I want to write a stored proc where I will give a date as a parameter and it should give me all the records there my date is between the startdate and the enddate.

Also I want to create a temp table in the procedure and the table gets populated with all the dates that comes between startdate and enddate, both dates inclusive.

I know this might be a tall order, but I am new to writing stored procedure, so I will be obliged if somebody can help me out


View Replies !   View Related
SQL Dates
OK, so I can return (& therefore use) the last day of last month using

select (GETDATE()- DATEPART ( dd , GETDATE()))

Which returns 31-03-2004 (dd-mm-yyyy)

Has anyone a good way of determining a way of deriving say a date such as 01-01-2004 (1st Jan)....

I'd like to get some data where my dmd.sdate falls always in the previous quarter.. but would like it to be not hard coded...

Currently I have

FROM pdunity.dbo.cust cust,
pdunity.dbo.dmd dmd
WHERE cust.rowno = dmd.rowno_custdmd_cust
BETWEEN '01/01/2004'
ORDER by dmd.sdate asc

Is there some form of function I can use to return 01/01/2004 automatically ?


View Replies !   View Related
Dates ...
why does this sql return the dates in different formats? Is it a default setting on the server or do i just handle it on SQL?

use northwind

select top 20 orderdate from orders

select top 20 left(orderdate,10) from orders



View Replies !   View Related
What is the difference between GetDate() & CURRENT_TIMESTAMP. Which one preferebly should be used.

View Replies !   View Related
Hi can anyone help me , or am I on the wrong track.

Is there any easy way to create a stored procedure that inserts into a table the relevant months dates into a table based on the month and year as parameters.
I.e say the parameters passed are 01/2001 hence based on this all of the month of January 2001 dates are inserted into a table in this format : 'Jan 01 2001 12:00:00'


View Replies !   View Related
I have a columns with storeID's and dates i need to be able to find the difference of date for a certain store for its Min(Date) to the End of that Month


Date StoreID Difference of Date to end of the
2008-01-02 00:00:00.000 163
2008-01-03 00:00:00.000 165
2008-01-01 00:00:00.000 167
2008-01-02 00:00:00.000 180

View Replies !   View Related
Dates Between Two Dates
Hi friends,
I need to display the dates in between two dates without using tables. two dates are today date and 10th date from today date.

View Replies !   View Related
I have an assignment using SQL this is the first time i have used it but i can understand the basics.

It is for an instrument service company and i need to find what instruments have not been serviced for a year.
i already know i have to:

SELECT instrument number, date of last service
FROM Instrument table

but after this i am unsure what code i can use in order to find all instruments that have not been servided in over 365 days what code can is best to use?

View Replies !   View Related
How would I pull just a list of dates for say the next year or two

View Replies !   View Related
Sum Between Dates

I am trying to calculate our job value and product costs over a given time period. But if I run my query, the numbers just dont look right at all. Please can you have a look at this query and see if anything stands out?

-- gets current WIP Job information.
-- requires item details from this.
USE Staging
-- declare start and end variables
SET @Start = '01/01/2008'
SET @End = '01/02/2008'
SUM(jbs.Value) AS ProducionValue,
SUM(prd.Cost) AS Cost,
CONVERT(CHAR(10), @Start, 103) AS [From],
CONVERT(CHAR(10), @End, 103) AS [End]
Job.[Job No],
Job.[Cust Name],
Job.[Req'd Date],
Job.[ProdStartActual] BETWEEN @start AND @End AND
Job.Cancel = 0 AND
Job.Sales = 1 AND
Job.Invoiced = 1 OR
Job.[ProdStartActual] BETWEEN @start AND @End AND
Job.Cancel = 0 AND
Job.Sales = 1 AND
Job.Invoiced = 2
Item.[Job No],
) AS itm ON jbs.[Job No] = itm.[Job No] INNER JOIN
Product.[Product Code],
) AS prd ON itm.Code = prd.[Product Code]

"Impossible is Nothing"

View Replies !   View Related
Dates Between
If I give the from date and to date i should get all dates the between from and to.




Thanks in advance..,


View Replies !   View Related

I have date columns in my tables defined as smalldatetime. How do Iperform a Select that will retrieve records with datesequal to the date selected in a calendar control as follows:

<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:ReservationsConnectionString %>"

SelectCommand="SELECT [TIM_Time], [TIM_ID], [TIM_Valid_From] FROM [Times] WHERE ([TIM_Time] = @TIM_Time)">


<asp:ControlParameter ControlID="Calendar1" Name="TIM_Time" PropertyName="SelectedDate"

Type="DateTime" />


I get no records when I know they are there - do I have to put in additional checks to cater for the time component of the column?

Thanks in advance.

View Replies !   View Related
Get Dates NOT Between X And Y
Hi. I hope this is the write place to post this, I hope it is.

basically, I want to be able to return me a query of giving me available dates in a table.

What I mean is that, if I have a table with fields including start date and end date, I want to return me the dates which are NOT listed/stored in the table.

kind of like a booking system, where you store the room reservation dates and obviously you don't want to double book that room, so I would like all the available dates to be returned back.

is this possible? how can I go about doing this?


View Replies !   View Related
Hello people! I have a question: I have a datetime field in my database. When I add a datetime variable (in 12.03.2008 format) to stored procedure (from C# code) that actually updates that field - everything ok. but when I am trying toupdate a datetime field with string 12.03.2008 (no matternvarchar or datetime type)in T-SQL code - the date that i receive - 2008-12-03, it means that month and day are swapped! How can I fix it? Thanks.

View Replies !   View Related
How Do I Compare Dates?
Hi,I need to compare Todays Date with a Date in the Table (DateExpired)to see if the membership expired. How do I do that?   thanks 
SELECT  DateExpired  FROM Member

View Replies !   View Related
Days Between Two Dates.
Hi all,
I have a table in which I have two fields in my DB.
FromDate and ToDate.
Both are stored as Varchar(MAX).
I would like to have an SP which gives me the Days in Between them.

View Replies !   View Related
Working With Dates
I am starting to play with a datetime field in sql server 2005
i wanted to write the date and time to my database in seperate fields but if if format my input to dd-MMM-yy i end up with 02-february- 2008 00:00
and if i try for the time i get 01/01/1900 12.00
i can put them both in the same field, thats not a problem for be but how do i then do an sql query to get backj say all records where the date is between the 01-jan-2008 and 02-feb-2008
Maybe if some one can point me at a tutorial it may assist me

View Replies !   View Related
Compare Two Dates
I need to compare tow dates DateField1 and DateField2 and find number of hours between these two dates. Then I need to deduct non-business days and hours (Business days: Monday-Friday and Business Hours: 7:00am-7:00pm) from this and find net hours. How can I do this?

View Replies !   View Related
Searches On Dates...?
Dear all
I was doing research oh how to do some searches on dates that allow a bit of a freedom to the person searching. They should be able to specify the parameters.
For example how would you make a search for all events that happened on a specific day in any year,any month? example : every 18
Or how would you searh for values that happened in a specific month in any year and any day? eg. May
Or how would you search for values that happen in a specific year and any day and month? eg. 2007
Or how would you search for values that happen every 18 May?
I tried few things and can only work out the search for the year bit. The values are saved in the database as DateTime.
Any advice is apreciated.

View Replies !   View Related
Formatting Dates
I imported data from a text file, where dates are currently in the format:   050729 to represent July 29, 2005.
 How could I write a sql statment to put make this show up as 07/29/05?

View Replies !   View Related
Between Dates Query - HELP!!!
Hi,I have an SQl query that will list the results if it lies between two dates, for example;SELECT * FROM TABLE WHERE { fn Now() } BETWEEN Date1 AND Date2This returns all results where Date1 and Date2 fall between the Current DateWhat i am looking for is a way to replace the { fn Now() } with a date of my choice.For example;SELECT * FROM TABLE WHERE '10/10/2006' BETWEEN Date1 AND Date2However this does not work.Has anyone any ideas why this may be ??Thanks in advanceAndrew Vint 

View Replies !   View Related
Sql Server Dates :S
I have an application where there is a form to enter some data to the sql server 2005 database.
when the form is submitted, I also use Date.Now to insert the date the article was submitted. It enters fine. E.g. if I submitted it today, it would display 08/06/2006 (which is 06 August 2006). When getting the records,  I use, "dd MMM yyyy" to format the date according to my culture. However, the result I get is 08 June 2006
What might be the problem. I hate working with dates with sql server

View Replies !   View Related
Comparing Dates
I am trying to retrieve the data that are not more than 3 months. How do I do this? The closest thing that I can do is...
(dbo.CLASSIFIEDADS.PostDate > CONVERT(DATETIME, '2006-03-26 00:00:00', 102))
I want to be able to put 3 months in there somehow...
Thanks in Advance!

View Replies !   View Related
Comparing Dates.
Hi All,
I have a database field (datestamp) which returns the date the records were inserted into the database. The datestamp was created with the now(); function in .net and is in the following format: 5/23/2006 2:27:45 AM
I basically want to return all records that were inputted more than 28 days ago. I have had alook though some other posts and below is the closest query that i could find but unfortunately it does not work for me.
SELECT id, datestampFROM table WHERE datestamp > DateAdd(d, 28, GetDate())
Thanks in advance,

View Replies !   View Related
Working With Dates
I need to find Monday's DATE (and Tuesday's, and Wednesday's, etc.) of Week number 44 of the year 2005 for my stored procedure.  Does anyone know how I can do that?

View Replies !   View Related
Sql Server And Dates
My ultimate goal is to display records within a date range. I am using dropdown lists populated from the database as start and end dates for the ultimate SQL Statement. The field is a smallDateTime type.
The begining date populates without todays date using the following:
//Auto fill fields
SqlCommand command = new SqlCommand("Select distinct CONVERT(NVARCHAR(10),insertDate,101) as iDate from surveyOwner order by iDate DESC", connection);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
FirstDate.DataTextField = "iDate";
FirstDate.DataSource = reader;
It works great except records with todays date are excluded throughout.
I was hoping there was something small I was missing.

View Replies !   View Related
Comparing Dates In SQL
I am wondering how I would create a SELECT that will select the most recent date from one of two tables. For example, table1 has a field called LastUpdate and table 2 has a field called LastUpdate.  I need to grab only the most recent date.   I tried this using an inner join...but that didn't work because it only picks the lastupdate form one table only.  talbe1 and table2 are tied by table2.table1id. 
Can anyone help?

View Replies !   View Related
Get Period Of Dates
Hi,Just wonder if i can get a period of dates to be inserted into a temp table (with a single field [Sales_Date]) base on a Start and End Date using a select query?For Eg,Start = '8/1/2005', End = '8/5/2005'In the temp table,8/1/20058/2/20058/3/20058/4/20058/5/2005 Your help is appreciated. Thks.RgdsRyan

View Replies !   View Related
Problem With Dates
I am having a problem inserting dates into SQL server 2000. I have an aspx page which contains a simple form.

This form data is inserted into the database on submission. On submission to SQL Server the date field is changed to 01/01/1900

This is the concatenated INSERT statement which is generated:

INSERT INTO Applicant (appTitle, appFname, appSname, appDOB, appEmail, appTel, appTelB, appAdd1, appAdd2, appAdd3, appAdd4, appPostcode, appPassword) VALUES ('Mr', 'John', 'Smith', 01/04/78, '', '01258 698523', '', '1 The Smithy', 'Old Town', 'Oldville', '', 'OS6 8IU', 'Smith3969')

I have tried wrapping the date in ' ', but this doesn't work either.

Any help would be greatly appreciated


View Replies !   View Related
Adding Dates In SQL
I am trying to pull only records that are greater than 1 month prior to today's date. This is what I have so far....

select *
from MyTable
where eventDateStart > '$Now'
order by eventDateStart

$Now is a variable that pulls in today's date. This sql statement delivers only records that have a eventDateStart greater than today. My problem is I do not know how to make it so it only shows records that are 1 month prior.

Any idea how to do this?

View Replies !   View Related
Start N End Dates
hi may i know how do i load a report based on the entered value for start and end date?

I understand that i have to create parameters and dataset but how to make use of them?

View Replies !   View Related

Copyright 2005-08, All rights reserved