SQL Syntax


Author
Message
LeRoy Jackson, Jr.
LeRoy Jackson, Jr.
StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)StrataFrame Beginner (22 reputation)
Group: Forum Members
Posts: 14, Visits: 55
Ok I know that this is very simple but I can't figure it out.

I am using SQLExpress and I have a table called Library.  I have a BO call Library1.  I created a method called FillByDate.

The column on my table that I want to look at is media_date it is of DataType DateTime.

my SQL is: "Select * from library where Media_date = @ldDate"

 ldDate = cdate("10/15/2006")

I am also new to Sql Server so My Question is what date conversion function do I need to get my parameter and my Table.DateTime Field to work. 

PS, I don't know what the actual time would be...Just the Date

Replies
Flavelle Ballem
Flavelle Ballem
StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)StrataFrame User (150 reputation)
Group: Forum Members
Posts: 56, Visits: 126
Another approach to stripping the time from a date is to do a double cast as shown below:

cast(cast(@date as int) as datetime)

This was suggested to me on an MSDN forum and works very well.

Regards,

Flavelle

Trent Taylor
Trent Taylor
StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)StrataFrame Developer (14K reputation)
Group: StrataFrame Developers
Posts: 6.6K, Visits: 7K
On the BrowseDialog, set it to searching with a BeginsWith and see if that resolves your problem.  This should exclude the time.
GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Threaded View
Threaded View
LeRoy Jackson, Jr. - 19 Years Ago
LeRoy Jackson, Jr. - 19 Years Ago
StrataFrame Team - 19 Years Ago
LeRoy Jackson, Jr. - 19 Years Ago
StrataFrame Team - 19 Years Ago
Larry Caylor - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Larry Caylor - 19 Years Ago
Flavelle Ballem - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Larry Caylor - 19 Years Ago
Larry Caylor - 19 Years Ago
Trent L. Taylor - 19 Years Ago
Larry Caylor - 19 Years Ago

Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search