Forum Replies Created

Viewing 15 posts - 781 through 795 (of 2,007 total)

  • RE: Giving developers local admin access on their workstations

    In my workplace, we have Windows Server 2008r2 installed on developer workstations.

    This allows each developer to run Hyper-V so have their own virtualised workspaces. If you ruin your machine,...

  • RE: Help with a query.

    seth delconte (3/26/2012)


    REPLACE works too 😀

    SELECT id,Nivel,REPLACE(A,'0','')A,REPLACE(B,'0','')B...

    FROM @tblCron

    I try to avoid implicit conversions where possible

  • RE: Help with a query.

    Really? Did you actually try this on your own first?

    Look up CASE and CAST.

    SELECT id, Nivel,

    CASE WHEN A = 0 THEN '' ELSE CAST(A AS CHAR(1)) END AS...

  • RE: ISDATE() And converting

    Well, on the rare occasions that I've been forced to do something like this I would generally use a CLR regex.

    If you need a pure SQL solution, would something like...

  • RE: Pivots using Tally Table

    Ah-ha!!

    Told you it was my fault 😀

    OK, I don't have my sandbox turned on at home, so can't give you tested code, but basically it's because we are selecting duplicates.

    So,...

  • RE: Pivots using Tally Table

    NuB2Sql (3/23/2012)


    Thank you VERY much! finally something is making sense!

    however, here are the errors i am getting when I try your code:

    Msg 1056, Level 15, State 1, Line 2

    The number...

  • RE: Select Query, but being picky about the Rows Returned

    Couple of ways: -

    SELECT RelationshipID, ParentID, ChildID, RoleID, StatusID,

    CreateDate, ActionID

    FROM (SELECT a.RelationshipID, a.ParentID, a.ChildID, a.RoleID, a.StatusID,

    a.CreateDate, a.ActionID,

    ROW_NUMBER()...

  • RE: Pivots using Tally Table

    NuB2Sql (3/23/2012)


    Sorry about that!

    I have edited it as needed (hopefully)

    and thanks for your help--very much appreciated.

    No problem 🙂

    OK, firstly I've fixed your create table statement and formatted the whole...

  • RE: Pivots using Tally Table

    Hello and welcome to SSC!

    I'd like to be able to help, but it seems you've forgot to post readily consumable sample data and ddl scripts.

    If you could read this article[/url]...

  • RE: Need help in split

    Jeff's string splitter is the quickest non-CLR method.

    Here's a way using XML: -

    DECLARE @str AS NVARCHAR(max), @XMLList AS XML;

    SET @str = 'Alter table dbo.TableA add test int';

    SELECT @XMLList = CAST(REPLACE(REPLACE(REPLACE(

    ...

  • RE: rows into columns

    If this needs to be done in SSIS, I'm fairly sure that it has PIVOT/UNPIVOT operators in the data flow task.

  • RE: SQL Query Help

    --Your sample data

    SELECT ChoiceId, ChoiceName, QuestionId

    INTO yourTable

    FROM (VALUES(101655,'3 Months',15418),(101656,'6 Months',15418),

    (101657,'1 Year',15418),(101658,'Whenever Necessary',15418),

    ...

  • RE: distribute evenly a single column data to multiple column

    Lambert Antonio (3/21/2012)


    thanks Cadavre

    No problem.

    In case you're interested, the cursor is also massively outperformed by my method as well.

    See: -

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

    BEGIN

    DROP TABLE #testEnvironment;

    END;

    --1,000,000...

  • RE: distribute evenly a single column data to multiple column

    Here's one way: -

    --Your sample data (Thanks, makes it much easier when readily consumable sample data exists)

    DECLARE @t1 TABLE (refno VARCHAR(50));

    INSERT INTO @t1

    SELECT 'r1'

    UNION SELECT 'r2'

    UNION SELECT 'r3'

    UNION SELECT 'r4'

    UNION...

  • RE: Query help for a table

    Here's one way: -

    BEGIN TRAN

    --Create sample data

    CREATE TABLE yourTable (Transdate DATE);

    INSERT INTO yourTable

    SELECT Transdate

    FROM (VALUES('2012-01-01'),('2012-01-07'),('2012-01-10'),('2012-01-12'),

    ('2012-01-18'),('2012-01-21'))a(Transdate);

    ...

Viewing 15 posts - 781 through 795 (of 2,007 total)