Forum Replies Created

Viewing 15 posts - 1 through 15 (of 51 total)

  • RE: passing parameter to stored procedure

    Lynn Pettis (12/9/2009)


    Would help if you posted your code. Not much help otherwise.

    I have worked on .NET a little so tried to provide a solution to the OP. I...

  • RE: passing parameter to stored procedure

    Do you always have to check for StageID=0 OR StageID=1??

    If yes, then I would make your StageID parameter passed to the SP as int and change the SP to look...

  • RE: bcp to csv syntax errors

    What is the output you are getting when you run this in SSMS? I am thinking 12 rows affected is 12 line of errors not the number of rows from...

  • RE: bcp to csv syntax errors

    As per BOL syntax for xp_cmshell is

    xp_cmdshell { 'command_string' } [ , no_output ]

    Try putting your bcp command in quotes like this:

    EXEC master..xp_cmdshell 'bcp "SELECT * FROM menus.dbo.ri_res WHERE...

  • RE: Call stored proc from stored proc

    Exec @Result = p_myproc1

    running this code executes the SP p_myproc1 and gets the status of the SP p_myproc1 in the @Result. 0 means p_myproc1 executed successfully. If you want...

  • RE: Using MAX and LTRIM, RTRIM together

    Slick84 (11/24/2009)


    I get all zeroes.

    CHARINDEX(CHAR(9), ItemNo, 0)

    Btw.. do I change the 9?

    Is "ItemNo" the right column name? Just wanted to make sure. 🙂

  • RE: Using MAX and LTRIM, RTRIM together

    yes, change 9 to 10 and change 9 to 13. do you get zeroes for both?

  • RE: Using MAX and LTRIM, RTRIM together

    Can you pls. run the below query?

    SELECT CHARINDEX(CHAR(9),Column4, 0) FROM [server].[db].[dbo].[view]

    Do you get values other than 0 in the result set? If yes than you don't have trailing spaces...

  • RE: Using MAX and LTRIM, RTRIM together

    Slick84 (11/24/2009)


    Hello,

    I'm trying to trim the trailing spaces in my column data using below t-sql.

    MAX(LTRIM(RTRIM(column_Name)))

    Addt'l info, I use the max keyword to successfully group my data. Could the max be...

  • RE: T-SQL

    Good question BitBucket. Since I got it wrong I made a point to research (and also going through the discussion) why I was wrong and so in turn learned more...

  • RE: Conditional Group by?

    Thanks for taking the time out to explain Lutz, appreciate it.

    Thanks,

    Supriya

  • RE: Conditional Group by?

    lmu92 (11/12/2009)


    Here's another solution based on ROW_NUMBER.

    It covers the issue of having code is null and location is not null.

    Comparing the two row_number solutions will result in almost identical...

  • RE: Conditional Group by?

    @Lamprey13: Nice trick using Row_Number(); going in my file of "SQL tips and tricks" 🙂 It had one issue though, your script ignores the row say when code...

  • RE: Conditional Group by?

    How about something like this:

    SELECT * FROM #tmp A

    WHERE code IS NOT NULL

    OR location IS NOT NULL

    ...

  • RE: query to modify

    Lessons learned on my part too..I just wasted my precious time :pinch: advocating for someone who can't acknowledge his mistake and appreciate a good deed.

    I also checked the other...

Viewing 15 posts - 1 through 15 (of 51 total)