Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

Hi all

 

Am having a problem with the following sql statement... The line that is giving the problem is: ((Scan.ScanDate) between "+dateA+" and "+dateB+")

 

When i remove this line i get all the data i need, but when i add it in no data is returned, now i have verified that the two dates that i am entering are in the table.

 

Would appreciate any suggestions

 

Mike55

 

Select Student.SchoolNum, School.SchoolName, Student.CourseName, Student.MartID, Student.StudentId, Student.StudentNum, Student.Forename, Student.Surname, Scan.ScanDate, Scan.Reason
From (Student inner join scan on student.MartID = Scan.MartID) innerjoin school on student.SchoolNum = school.SchoolNum
where ((School.MartSchoolID) >= "+value+" and (School.MartSchoolID) <= "+value+") and ((Scan.ScanDate) between "+dateA+" and "+dataB+") and ((Scan.Reason) = 'Absent'  or (Scan.Reason) = 'Suspended')

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted
If ScanDate is a date field you need to use # around the dates supplied

((Scan.ScanDate) between #"+dateA+"# and #"+dataB+"#)

 

HTH

/Kejpa

 

 

Thanks man,

 

Had just solved the problem before looking at this posting. Is it possible to do the following type of insert statement in SQL Server 2000

insert into table 
values (Do a nested select), 0,0,0

i.e.

insert into table1
values (Select col1, col2 from table 2),0 ,0 ,0

 

?????

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted

insert into table1

Select col1, col2, 0 ,0 ,0 from table 2

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Posted

In relation to using #, SQL Server throws an error saying that it is an unrecognised character.

 

Mike55

A Client refers to the person who incurs the development cost.

A Customer refers to the person that pays to use the product.

------

My software never has bugs. It just develops random features. (Mosabama vbforums.com)

Posted
user parameters for dates and forget about the format

Joe Mamma

Amendment 4: The right of the people to be secure in their persons, houses, papers, and effects, against unreasonable searches and seizures, shall not be violated, and no warrants shall issue, but upon probable cause, supported by oath or affirmation, and particularly describing the place to be searched, and the persons or things to be seized.

Amendment 9: The enumeration in the Constitution, of certain rights, shall not be construed to deny or disparage others retained by the people.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...