Forum Replies Created

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

  • RE: Creating a Test DB from a full backup of Prod

    If you set it to single user mode and some process connects to it before you start the restore, you will find it very difficult to disconnect that user.

    That is...

  • RE: SSAS Pivot refresh

    It is because invisible measures can still be used, if the measure name is known.

  • RE: Creating a Test DB from a full backup of Prod

    I don't drop it, because I want to keep the old db in case the restore fails 😉

    Bringing it offline and online again to drop the connections is elegant.

  • RE: Creating a Test DB from a full backup of Prod

    You need to end (kill) all other user sessions connected to the db TEST:

    declare users cursor

    for select spid

    ...

  • RE: Reclaiming Free Space in Database

    Good that you are reluctant. If you don't really need to shrink, don't shrink! 15% does not sound like much. 🙂

    If you really need to shrink and the database will...

  • RE: One script to drop all temporary tables

    This works, unless you use #temp table names with more than two subsequent underscores or ending with an underscore:

    CREATE PROCEDURE [dbo].[dtt]

    AS

    -- drop all #temp tables for current session

    begin

    DECLARE

  • RE: Character Field Declaration

    I just had to choose option 3 😀

    Seriously, it would fail in my environment (SQL Server 2005) but work with newer versions as stated above.

  • RE: Table row count grouped by date

    sp_msforeachtable example:

    sp_msforeachtable 'SELECT ''?'' AS ''table_name'',

    CONVERT(VARCHAR, [_when], 112) AS ''_when'',

    COUNT(*) AS ''records''

    FROM ?

    GROUP BY CONVERT(VARCHAR, [_when], 112)'

  • RE: SQL 2005 Filling NULLS

    Please provide us with your code and sample data from both tables.

    Just guessing from what you write, you left join table2 to table1 with the _Movement_ ID.

    You will first need...

  • RE: Hide resluts pane for queries with no resluts

    Use temporary tables to store the results and check if they return something before selecting from them

    SELECT 1 Test INTO #t1

    SELECT 2 Test INTO #t2

    DELETE #t2 --now #t2 is empty

    SELECT...

  • RE: Convert XML to String with formatting

    Nice! I had the same Problem, but was lazy - so all I did was this (in SSRS):

    =Replace(Fields!DATA.Value, "><", ">"& vbcrlf &"<")

  • RE: SQL syntax

    SELECT*FROM[sysobjects]ORDER BY 1desc

    or even

    EXEC('SELECT*FROM[sysobjects]ORDERBY1desc')

    welcome to SQL golfing - omg LOL

    The second thing is especialy bad, play with the order by to see why 😀

  • RE: FizzBuzz

    Gsquared your "ultimate version" is much fun to read!

    Now you only need to tell Jeff that you always code like that 😛

  • RE: FizzBuzz

    No offence taken, Jeff. But you made me think about my habits, thanks for that 🙂

    Being lazy and pragmatic is a very important developer attitude to me.

    I never realized...

  • RE: FizzBuzz

    Yeah I know - i have rewritten quite a few poorly coded loops and cursors that performed badly.

    It just takes me longer and is not the first solution that pops...

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