Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2003

    Unanswered: problem with convert 2000 server 2000

    we want to insert date into table testDate in Datetime or another dataType in field testDate and extract it in hijry Date format And compare it with two Date.
    acording to the articles we insert it in to the table in nchar dataType and then we want to extract it in datetime dataType using convert function in sql server :

    (( SELECT CONVERT(datetime, ' testDate', 131)
    FROM testDate ))
    that gives this error:

    (( Server: Msg 241, Level 16, State 1, Line 1
    Syntax error converting datetime from character string. ))

    if we want to insert Date in datetime dataType it enter in gregorian Date format.
    while we want Date in hijry format.

  2. #2
    Join Date
    Sep 2003

    Re: problem with convert 2000 server 2000

    try this, it may work??? You will have to sort the hours and minutes etc...

    convert( smalldatetime, ( datename( yy, testdate) + ' '
    + datename( mm, testdate) + ' '
    + datename( dd, testdate)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts