Forum Replies Created

Viewing 15 posts - 121 through 135 (of 167 total)

  • RE: Adding CRLF to T Sql

    Try:

    Exec sp_CmdShell 'Echo Text for Line 1 & Echo Text for Line 2'

    The "&" is the Command-Shell command separator. Of course, you could redirect this output to a file as...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Cannot load the DLL xpstar.dll, or one of the DLL''''s references. Reason: 126(The specified module could not be found.).

    Run Microsoft's dependency checker (depends.exe, ya, I don't care for the name either...) against your DLL. You will also need to load the DLL's that your DLL references. You probably don't...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Assigning Output of a select query to a variable In SQL Server2000

    So much for conventional wisdom...

    This may not be what you want, but, try something like this:

    Declare @Str VarChar(8000)

    Set @Str=''

    Select @Str=@Str+','Col1+','+Col2+','+...+Char(13)+Char(10) from dbo.[YourTable] where ...

    Print @Str

    You get the idea...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Can OSQL retrun a value?

    Try this:

    -- Construct test UId table.

    If Object_Id('Test') is not Null Drop Table Test

    Select 0[UId] into Test

    -- Obtain the next UId.

    Declare @i Int

    Update Test Set @i=UId,UId=UId+1

    -- or --

    Update Test Set @i=UId=UId+1

    Which...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: xp_CmdShell - Giving Back - Sproc ShortPathName

    I use to write Extended Stored Procedures to handle the stuff that SQL wasn't "comfortable" with but XSProc are difficult to manage (versioning, interface requirements, environemtal requirements, testing, documentation... ad...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Threading from an xp

    Use xp_CmdShell and START a copy of OSQL to run a script...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: xp_CmdShell - Giving Back - Sproc ShortPathName

    Ya, I use to use xp_FileExists, but, I figured there's less a chance of the Command Prompt stuff going away than xp_FileExists... but then, who ever would have thought that...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Checking for value in select?

    Try this:

    If Object_id('test') is not null Drop Table Test

    Create Table Test(Id int,ParentId int,[Name] varchar(256))

    Insert Test Values(1,Null,'A')

    Insert Test Values(2,1,'B')

    Insert Test Values(3,1,'C')

    Insert Test Values(4,2,'BA')

    select

     Id,

     Name+Case IsNull((select top 1 t2.ParentId from test t2 where...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Diff between SET and SELECT

    Ya, I know... here's the code...

    Declare @v1 int,@v2 varchar(256)

    Set @v1=123

    Select @v1=456,@v2='789'



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: Diff between SET and SELECT

    Paste the following into QA and click the "Display Estimated Execution Plan" tool button. Hang you mouse cursor over each "Select Cost 0%" page-image and you'll see that the "set"...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: xp_CmdShell - Giving Back - Sproc ShortPathName

    Uuups, sorry, its another "DOS" hack sproc in our common library system... Here's the code:

    Use Common

    If Object_Id('PathExists') is not Null Drop Function PathExists

    Go

    Create...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: determining whether a directory exists? xp_dirtree, xp_subdirs ?

    If you don't have an allergic reaction to xp_CmdShell you could...

    Declare @rc Int

    Exec @rc=master.dbo.xp_CmdShell 'If Exist "c:\boot.ini" (Exit 1) Else (Exit 0)',no_output

    Select @rc[Return Code]



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: avoid dynamic sql with zero or more params

    You a funny guy There is a practical limit to using this technique, I leave it up to you to make that call...



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: avoid dynamic sql with zero or more params

    I hear ya... But, you write the code once... your run it a bazillion times.. having SQL use the proper indicies can cover for a little code bloat.



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

  • RE: avoid dynamic sql with zero or more params

    Why not use some code

    If @p1 is Null Select * from Table

    Else Select * from Table where c1=@p1 



    PeteK
    I have CDO. It's like OCD but all the letters are in alphabetical order... as they should be.

Viewing 15 posts - 121 through 135 (of 167 total)