Forum Replies Created

Viewing 15 posts - 2,221 through 2,235 (of 2,458 total)

  • RE: how to restore a stored procedure from a backup

    If you have db backed up as a single .BAK file then restoring the database is the only way I can think of; there is no way to dig around...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: How to create the Dynamic Table...

    Are you looking for something like this...

    --(1) THE DATA

    IF OBJECT_ID('ajbtest.dbo.PivotA') IS NOT NULL

    DROP TABLE PivotA;

    CREATE TABLE dbo.PivotA (IDT int, A int, B int);

    INSERT dbo.PivotA VALUES (24,1,-1),(24,2,-2),(24,3,-3),(24,4,-4),(25,5,-5),(25,6,-6),(25,7,-8),(26,8,-8),(26,9,-9),(26,10,-10);

    --SELECT * FROM dbo.PivotA;

    --(2) THE...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Report keeps on failing

    sabah_seattle (6/14/2013)


    Hello sql1411,

    Thanks for responding. Here is the error I am getting -

    An error occurred during local report processing

    An error has occurred during report processing.

    Query execution failed for dataset "Sales".

    Login...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: What Queries/SPs Are Running Right Now ?

    HowardW (6/13/2013)


    You can write your own queries, using the DMVs, which is a good learning exercise, but I'd recommend using the brilliant sp_whoisactive.

    I wanted to second that.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: .sp_send_dbmail sending an XML File dashes in front of -<Label> ??

    To get rid of those dashes you could do something like this:

    DECLARE @x XML,

    @x1 varchar(1000)='

    - <CLUB>

    -...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Calculate Previous Business Day Exclude Saturday, Sunday and Holiday

    You would need to do something like this:

    -- (1) SAMPLE DATA SETUP

    IF OBJECT_ID('tempdb..#tblHoliday') IS NOT NULL

    DROP TABLE #tblHoliday;

    IF OBJECT_ID('tempdb..#dates') IS NOT NULL

    DROP TABLE #dates;

    --Holiday table, I only added New Years,...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Identify postcode from multiple fields

    Ed Wagner (6/12/2013)


    There are plenty of articles out there on getting started doing it .NET. Here's one: http://msdn.microsoft.com/en-us/magazine/cc163473.aspx.

    Depending on how you write it, this approach can be very efficient.

    After...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Identify postcode from multiple fields

    mike.dinnis (6/12/2013)


    Hello,

    I have a table with five fields used to hold address data. Due to poor practices the users have been able to enter any data in any field. They...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: slowly changing dimension?

    I have a solution that will work with your sample data. I was trying to come up with something that works when there are more than 3 records but this...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: SQL commands to learn

    vxhughes (6/6/2013)


    Thanks to all for their recommendations.

    I've already started on

    http://beginner-sql-tutorial.com/sql-commands.htm

    and

    http://www.w3schools.com/sql/sql_intro.asp

    and I've bookmarked "Stairway to T-SQL DML" at

    http://www.sqlservercentral.com/stairway/75773

    A couple of quick questions:

    • Which of Itzik Ben-Gan's T-SQL fundamentals books do I...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: SQL commands to learn

    OTF (6/6/2013)


    bgraham 64271 (6/5/2013)


    SQLSACT (6/5/2013)


    vxhughes (6/4/2013)


    Can anybody recommend a good online guide to SQL commands? Or at least a list of the ones I should learn first?

    Have a look...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Parsing a variable for a where clause

    Misread the requirement. Comment removed.

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Greater/Less than on text column

    Something like this perhaps:

    IF OBJECT_ID('tempdb..#tmp') IS NOT NULL

    DROP TABLE #tmp;

    CREATE TABLE #tmp (val varchar(10) primary key)

    GO

    INSERT INTO #tmp

    SELECT '5'UNION ALL

    SELECT '6DN'UNION ALL

    SELECT '7'UNION ALL

    SELECT '10'UNION ALL

    SELECT '11DN'UNION ALL

    SELECT '12'UNION ALL

    SELECT...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Indexed view

    SQL_Surfer (5/29/2013)


    Is it a good idea to put index on view? Some of the views are taking longer to execute and I am thinking about putting index on views. But...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

  • RE: Counting duplicates

    Lynn Pettis (5/28/2013)


    Alan.B (5/28/2013)


    OTF (5/22/2013)


    phc (5/18/2013)


    I have gotten a bit further on by nesting a query, but I am not sure I have the distinct right

    SELECT C.first_name"Provider", Count(C.provider_no) "Diabetics with...

    "I cant stress enough the importance of switching from a sequential files mindset to set-based thinking. After you make the switch, you can spend your time tuning and optimizing your queries instead of maintaining lengthy, poor-performing code."

    -- Itzik Ben-Gan 2001

Viewing 15 posts - 2,221 through 2,235 (of 2,458 total)