using ISNULL with string

  • I would like to say if the firmname is null, then pass empty string instead.

    I thought this would do the job, but it doesn't.

    AND (ISNULL (@firmname, '')='' OR firms.firmname like @firmname + '%'

    after I run the query, it says the procedure expects @firmname. What do I do wrong?!

    Thanks.

  • If you created a stored procedure, and your header looks like this:

    CREATE PROCEDURE Blah

    @firmname varchar(50)

    AS

    and not like

    CREATE PROCEDURE Blah

    @firmname varchar(50) =NULL

    AS

    Then you need to pass in @Firmname every time.

    If that's not the case, please post the rest of the query, and any line you may use to call it.

    Seth Phelabaum


    Consistency is only a virtue if you're not a screwup. 😉

    Links: How to Post Sample Data[/url] :: Running Totals[/url] :: Tally Table[/url] :: Cross Tabs/Pivots[/url] :: String Concatenation[/url]

  • thanks, i was missing =null part.

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

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