Forum Replies Created

Viewing 15 posts - 166 through 180 (of 608 total)

  • RE: IF table exists, DROP TABLE then CREATE TABLE - script not working

    jhager (11/4/2013)


    Other than missing the END statement (which exists later on in my script), I'm still not seeing anything incorrect.

    The code works for me. The table is created correctly.

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: IF table exists, DROP TABLE then CREATE TABLE - script not working

    Abu Dina (11/4/2013)


    You don't need to include the schema name when you call the OBJECT_ID function:

    OBJECT_ID(N'dbo.mtzcus_2014_CoreMenuAuditDetails', N'U')

    should be just

    OBJECT_ID(N'mtzcus_2014_CoreMenuAuditDetails', N'U')

    That's incorrect. You should include the schema name when you...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Statistics on a table but no index to match

    SQLJocky (11/1/2013)


    Yes, all of the _dta_ listings are showing as hypothetical.

    You can safely remove those.

    SELECT

    'DROP INDEX ' + QUOTENAME(name) + ' ON ' + QUOTENAME(OBJECT_NAME(object_id))

    FROM

    sys.indexes

    WHERE

    is_hypothetical = 1;

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: I got the following error Exporting to Excel 2010 from Report Manager

    Number of columns exceeds the maximum possible columns per sheet in this format; Columns Requested: 272, Max Columns: 256

    You cannot export more than 256 columns to Excel.

    http://msdn.microsoft.com/en-us/library/ms159836(v=sql.100).aspx

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: scheduling a job manually

    You can call msdb.dbo.sp_update_schedule

    sp_update_schedule

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Statistics on a table but no index to match

    It's possible they are hypothetical indexes, a remnant of database tuning advisor.

    What does the following return?

    SELECT

    name,

    is_hypothetical

    FROM

    sys.indexes

    WHERE

    OBJECT_NAME(object_id) = 'ABCTable'

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Moving a DB with compressed tables, what happens?

    Matt Crowley (10/31/2013)


    Only one other thing to add to this, just be sure you are migrating to an Enterprise edition SQL Server, as I do not believe that compression is...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Anyone have a process to save a procedure to network location, then drop it?

    What about creating a stored procedure database on your server.

    1. Loop through sys.procedures for _del_

    2. Fetch text from syscomments definition from sql_modules

    3. Create proc on stored procedure database

    4. Delete procedure...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: udf very slow?

    Jeff Moden (10/31/2013)


    +1. I don't know what others call the type of function you wrote for the "Apply" function but I call them "iSF" or "Inline Scalar Function". ...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: udf very slow?

    It is much faster to apply a table function.

    CREATE TABLE Test1 (ID INT);

    GO

    INSERT INTO Test1

    SELECT TOP 1000000 ROW_NUMBER() OVER (ORDER BY a.object_id)

    FROM sys.all_columns a

    CROSS JOIN sys.all_columns b

    GO

    CREATE FUNCTION UDF_INLINE (@Input...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Today's Random Word!

    Jerry

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Query spills to tempdb with correct cardinality estimates

    Jeff Moden (10/30/2013)


    martin catherall (10/30/2013)


    fair point Jeff, I used the term "spill to disk" to mean "spill to tempdb" - that was an error on my part.

    Let me re-phrase again...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Query spills to tempdb with correct cardinality estimates

    Your tempdb usage has nothing to do with cardinality estimates. It is because you are ordering by a NVARCHAR(2000) column and the sort operation is spilling to tempdb. Try the...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: What's in a Name?

    Richard Warr (10/29/2013)


    Sean Pearce (10/29/2013)


    My name can be spelt a few different ways and I am used to people getting it wrong....

    You make a valid point but it reminds me...

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

  • RE: Forum is chopping off characters...

    :Whistling:

    The SQL Guy @ blogspot[/url]

    @SeanPearceSQL

    About Me[/url]

Viewing 15 posts - 166 through 180 (of 608 total)