Forum Replies Created

Viewing 15 posts - 136 through 150 (of 444 total)

  • RE: Missing numbers in a series

    Hi...

    DECLARE @MissingNumbers TABLE (N INT)

    Declare @vMax int

    INSERT INTO @MissingNumbers

    VALUES (1),(2),(4),(5),(7),(8),(11),(12),(13),(15),(17),(19),(20)

    Set @vMax = (Select MAX(N) from @MissingNumbers)

    ;with wcte as (

    Select Top(@vMax) ROW_NUMBER() over(order by a.N) NAll

    from @MissingNumbers a, @MissingNumbers b

    ) Select...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Rebuild/Reoganize all indexes of all databases

    I have written this logic using sp_msforeachdb.

    I need to ask Why have you used this condition

    p.page_count >= 10

    Is this to check if the Index is large enough to...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Rebuild/Reoganize all indexes of all databases

    Had to change to run in SQL Server 2005. Just changed the initialization of @Loop ,@Qt and Total.

    Nice script. Just want to know Which Language?

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Select from two tables, side by side

    Plz try the last query that i posted. It gives result;

    A_RowID DataValueA B_RowID DataValueB

    NULL NULL ...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Nested Stored Procedure

    Hope ther is any way to find the nested tables as well.

    In dependency, we get tables used with Insert, Update and Delete Operations. No way to find the tables used...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Select from two tables, side by side

    New version of my query,

    Select Distinct * from (

    SELECT a.RowID A_RowID, a.DataValueA, b.RowID B_RowID, b.DataValueB

    FROM (Select *,Row_Number() over (order by Rowid) as rno from @TableA) a

    LEFT OUTER JOIN (Select *,Row_Number()...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Select from two tables, side by side

    Oh. Mistake in my query. I assumed that the Values of both tables will be same.

    This was my test script...

    Declare @vTable1 Table (id int, descr varchar(10))

    Declare @vTable2 Table (id int,...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Busy Work

    Cool...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Nested Stored Procedure

    Very helpful script.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Disable / Enable All triggers on all tables in sql server 2005

    sp_msforeachtable is a better option.

    sp_msforeachDb is another useful procedure.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Copy Table Structure Without Data Using 1 Line Query

    Very Simple. I usually go with this strategy.

    Good to share things like this. They can be very helpful to many.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Select from two tables, side by side

    Hi,

    I think your query should be like this...

    Select * from (

    SELECT a.RowID A_RowID, a.DataValueA, b.RowID B_RowID, b.DataValueB

    FROM @TableA a

    LEFT OUTER JOIN @TableB b ON b.RowID = a.RowID and b.DataValueB =...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Defensive Programming

    Never knew this. Had to use google to find the answer. 😀

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: Criteria Table

    Dynamic SQL is your solution. I witnessed this scenario in a differen way. I had the Where clause as the parameter and I use to build the query depending upon...

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

  • RE: keyword between

    I think the rownum is not the part of the table.

    OP have to clear this. Otherwise the query is very simple.

    ----------------------------------------------------------------------------------------------------------------------------------------------------------------------
    Sometimes, winning is not an issue but trying.
    You can check my BLOG
    [font="Arial Black"]here[/font][/url][/right]

Viewing 15 posts - 136 through 150 (of 444 total)