Forum Replies Created

Viewing 15 posts - 736 through 750 (of 2,007 total)

  • RE: TOP 10 of each Division

    Vedran Kesegic (4/19/2012)


    Yes, but CTE bring limitations: it wont work in a view, and it works on less SQL versions that without CTE. So, my choice is to use a...

  • RE: Problem with CTE

    This is quicker: -

    SELECT DATEADD(DD,N,GETDATE())

    FROM (SELECT N

    FROM (VALUES(0),(10),(20),(30),(40),(50),(60),

    ...

  • RE: Help with Case Query

    Hello and welcome to SSC!

    There's no need to use a cursor for this, which is great because a cursor solution would be slow! 🙂

    I'd like to be able to help...

  • RE: Does REPLACE automatically trim fields?

    aaa-322853 (4/16/2012)


    Please help me out with something.

    I have a query which selects several columns from a table and exports to a csv file ready to be loaded into a...

  • RE: Get the NON NULL and NULL values in a single query

    ColdCoffee (4/16/2012)


    Try this:

    SELECT *

    FROM @TABLE T

    WHERE ISNULL(T.fldID, '') = CASE WHEN @ID IS NULL THEN ISNULL(T.fldID, '') ELSE @ID END

    Be very very careful with this sort of approach. ...

  • RE: Question related to NOLOCK

    NOLOCK is equivalent of READ UNCOMMITTED.

    The very least of your worries is the possibility of reading "dirty" data (data that was inserted or updated then subsequently rolled-back). ...

  • RE: Date Format to String

    Nice Lowell 😀

    I did a quick test to compare, as I normally do when I see something different.

    IF object_id('tempdb..#testEnvironment') IS NOT NULL

    BEGIN

    DROP TABLE #testEnvironment;

    END;

    SET NOCOUNT ON;

    --1,000,000...

  • RE: Date Format to String

    AndrewSQLDBA (4/11/2012)


    Hello Everyone

    I know this is simple to most, but I cannot seem to get this correct. I am having issues with the minutes and seconds.

    I need a string format...

  • RE: CTE Usage

    GilaMonster (4/11/2012)


    Semicolons are statement terminators, as such they should terminate statements, not start them. We don't start sentences in English with fullstops.

    Exactly.

    When I started using CTEs (and didn't really understand...

  • RE: Tricky! obtain Stored Procedure Parameters as columns in result

    Spotted a bug in what I wrote.

    Should be like this: -

    DECLARE @p1SQL NVARCHAR(MAX), @p2SQL NVARCHAR(MAX), @sql NVARCHAR(MAX);

    SELECT @p1SQL = COALESCE(@p1SQL,'') + ',' + CHAR(13) + CHAR(10) +

    CHAR(39) + PARAMETER_NAME +...

  • RE: Tricky! obtain Stored Procedure Parameters as columns in result

    C# Screw (4/11/2012)


    Hi

    can I ask for some SQL query help ..

    How would I return all parameter names for stored procedure in first row, parameter datatype in the second row...

  • RE: ISNULL function

    Plenty of ways. . .

    Here's one: -

    DECLARE @test-2 DATETIME;

    SELECT @test-2 = ISNULL(b.EffectiveDate,a.EffectiveDate)

    FROM (VALUES (GETDATE())) a(EffectiveDate)

    OUTER APPLY (SELECT *

    ...

  • RE: Table Column with only time

    Why would you downgrade from 2008 to 2005?

    I guess you could do a constraint. . .

    CREATE TABLE test (ourTime CHAR(8));

    ALTER TABLE test ADD CONSTRAINT chkTime CHECK(ourTime LIKE '[0-9][0-9]:[0-9][0-9]:[0-9][0-9]'

    ...

  • RE: I want to run a batch file from query window or from Trigger.

    EXEC xp_cmdshell 'c:\whatever.bat'

    By default, xpcmdshell is disabled because inproper use is often a massive security hole. If you're going to use it, make sure no-one has access to run...

  • RE: Seperate a string from a certain character on

    Wallertown (4/11/2012)


    Thanks a lot for the more than quick soultion :w00t:

    No problem. Do you understand how it works?

Viewing 15 posts - 736 through 750 (of 2,007 total)