selecting a date column from a vb program

  • I am using VB.NET 2005 and want to send Select commands to a SQLServer2005, for instance

    Select * from Customers where OrderDate > ....

    ... is to be 4th Feb 2005 and is contained in a string variable in iso format (yyyy/mm/dd)

    How is it to be dealt with?

    thx

  • I think the function name is: DATE

     

    MohammedU
    Microsoft SQL Server MVP

  • thanks, but it didn't work as expected

    any other suggestion, please?

    thx

  • You can have your app convert the format to mm/dd/yyyy and then convert the date pulled in by your query to that format..

    CREATE PROCEDURE ap_getInfo

    @importedDate datetime

    AS

    SELECT CONVERT (varchar, [dateColumn], 101) [Date Column]

    FROM myTable

    WHERE [Date Column] = CONVERT(varchar, @importedDate, 101)

    GO

    This link has a list of the various styles that can go in place of style 101 that I used in the above query. See the list here: http://sqljunkies.com/Article/6676BEAE-1967-402D-9578-9A1C7FD826E5.scuk

    Hope that info helps!

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply