Results 1 to 11 of 11
  1. #1
    Join Date
    Sep 2007
    Posts
    3

    Unanswered: Query Help-----prob an easy answer out there somewhere

    I am curretnly a newbie at SQL Server..but i am really good with Access.....i am looking into converting to SQL Express but i have this one issue. Below is a snippet of SQL from my VB6 app. SQL Server 2005 says i cant use 'Cdbl'

    T, W, L_value.....are strings in the varchar in my SQL DB. OS_T, L, W dont exist on my actual DB i make the RS disconnected and play with the data. This snippet works fine in Access, but as expected it doesnt in SQLS...Wha are my options, if any? Thanks in advance for any help or advice.



    strSQL = strSQL & "ORDER.OS_T_value, "
    strSQL = strSQL & "Cdbl(0.0) as OS_T_Sort, "
    strSQL = strSQL & "ORDER.OS_W_value, "
    strSQL = strSQL & "Cdbl(0.0) as OS_W_Sort, "
    strSQL = strSQL & "ORDER.OS_L_value, "
    strSQL = strSQL & "Cdbl(0.0) as OS_L_Sort, "

  2. #2
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    What would happen if you simply removed the Cdbl(s)?
    Code:
    SELECT 0.0 As [OS_L_Sort]
    George
    Home | Blog

  3. #3
    Join Date
    Nov 2002
    Location
    Jersey
    Posts
    10,322
    know what?

    You should start using stored procedures then
    Brett
    8-)

    It's a Great Day for America everybody!

    dbforums Yak CorralRadio 'Rita
    dbForums Member List
    I'm Good Once as I ever was

    The physical order of data in a database has no meaning.

  4. #4
    Join Date
    Sep 2007
    Posts
    3
    Thanks for the response greg....i found my answer...i just havent posted it yet....so here it is....it worked like a charm.


    SELECT CAST( 0.0 AS float) AS [f_dec]
    , CAST( '0.0' AS float) AS [f_string1]
    , CAST( '1.5' AS float) AS [f_string2]
    , CAST( NULL AS float) AS [f_null];
    --<-----
    f_dec f_string1 f_string2 f_null
    ------- --------- ---------- -------
    0 0 1,5 NULL


    Thanks for your response.

  5. #5
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    Who's greg?
    Thanks for posting your answer
    George
    Home | Blog

  6. #6
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    Greg was the oldest one of the Brady Boys.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

  7. #7
    Join Date
    Jan 2007
    Location
    UK
    Posts
    11,434
    Provided Answers: 10
    I was considering not saying it, but hey...

    Who are the "Brady Boys"?
    George
    Home | Blog

  8. #8
    Join Date
    Nov 2005
    Posts
    122

    Try this instead

    [QUOTE=dragonsbb1616]SELECT CAST( 0.0 AS float) AS [f_dec]
    , CAST( '0.0' AS float) AS [f_string1]
    , CAST( '1.5' AS float) AS [f_string2]
    , CAST( NULL AS float) AS [f_null];
    --<-----
    f_dec f_string1 f_string2 f_null
    ------- --------- ---------- -------
    0 0 1,5 NULL
    QUOTE]

    That is just a lot of unnecessary work for the SQL Server.
    Use this instead:
    Code:
    SELECT  0e as [f_dec]
     , 0e as [f_string1]
     , 1.5e as [f_string2]
     , cast(null as float) as [f_null]

  9. #9
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by georgev
    Who are the "Brady Boys"?
    http://www.bradyresidence.com/sitcomsecrets.html

    you're way too young to remember that show (assuming it even aired on that side of the pond)
    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

  10. #10
    Join Date
    Feb 2004
    Location
    Burbank & Santa Cruz de la Sierra
    Posts
    3,716
    Oh great, introduce him to The Brady's with a story that exposes Dad's horrible little secret.

    Oh, and Geo, if you find any pages that are exposing a twisted-sister relationship between Greg and Marsha, don't believe it. Marsha always had the hots for Bobby. Greg eventually wound up living in a trailer park with Alice and her husband. It was a whole torrid, dirty affair that was spun-off after the demise of The Brady Bunch.

    That's not even getting into the situation with Jan and the basketball team after the prom her junior year.

    Seems that everybody had a few bones in the closet.
    aka "Paul"
    Non est ei similis.

    I just read "100 Things To Do Before You Die". I was surprised that "Yell for help!!" wasn't one of them

  11. #11
    Join Date
    Apr 2002
    Location
    Toronto, Canada
    Posts
    20,002
    Quote Originally Posted by TallCowboy0614
    ... everybody had a few bones in the closet.
    or various other places


    badump-bump tshhh


    rudy.ca | @rudydotca
    Buy my SitePoint book: Simply SQL

Posting Permissions

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