Forum Replies Created

Viewing 15 posts - 6,556 through 6,570 (of 7,616 total)

  • RE: SQL Query Help

    Purely fyi, I personally think a cross apply that names the value being used makes the code much easier to follow and easier to change later. For example:

    Select

    *

    from...

  • RE: Shrink helping performance

    GilaMonster (5/21/2013)


    Shrink alone can't speed up a query.

    Isn't that an overly broad assertion? If, for the sake of argument, some/all of the disk extents added were scattered all over...

  • RE: SELECT INTO ignoring IDENTITY column

    This should "turn off" the identity property:

    SELECT *

    INTO dbo.newtable

    FROM dbo.table

    UNION ALL

    SELECT TOP 1 (*)

    FROM dbo.table

    WHERE 1 = 0

  • RE: Making data in a column unique (that's not a PK)

    RedBirdOBX (5/20/2013)


    Would you be so kind as to provide an example?

    SalesmanID (PK)

    SalesmanSSN (ype, it's the social)

    FirstName

    LastName

    ...etc...

    ALTER TABLE dbo.tablename

    ADD CONSTRAINT tablename__UQ_SalesmanSSN UNIQUE ( SalesmanSSN )

    --of course you can name the constraint...

  • RE: space issue

    If you have an (extremely) large table(s), compress them [if on Enterprise Edition], particularly if they are (almost) never used, such as log/audit tables, etc..

  • RE: update statement optimization?

    First, you need an index on ceb.New_IndividualId: I'll assume you have that already.

    Second, I'd cluster the #tmpIndividualCreateDates table by i.IndividualID: I'll assume you've done that already.

    I guess the OUTPUT clause...

  • RE: Quering Code

    dwilliscp (5/14/2013)


    Thanks for the warning Jeff.

    On the Jobs front.. We almost never put SQL into the Job, but thanks for reminding me to check there too. Thanks to everyone...

  • RE: Quering Code

    I also search table sys.sql_modules, which contains the code for all sys.objects members of type P, RF, V, TR, FN, IF, TF, and R.

    If you want to check for use...

  • RE: Help with SQL Server backups slow ( backup performance slower than before after data purge)

    When you delete a large or very large numberr of rows at one time, SQL Server defers the actual deletes. The next time a page with deleted r0w(s) is...

  • RE: Index Text

    If the numeric portion is random anyway, definitely use all numeric characters if possible -- you're quite right: prefixing the random numbers with a fixed string will NOT help the...

  • RE: best practices - development help

    jenny 12957 (5/6/2013)


    hi,

    im not sure this is the right forum to put this in, but i am working on redesigning our company database, and i was looking for best practices...

  • RE: Sorting Records Going Into New Table.

    Just to clarify: with ROW_NUMBER(), you don't have to ORDER BY all the columns you want to SELECT; just one ORDER BY column is fine if that's all you need....

  • RE: Making Query SQL 2000 compatable

    I think this will do it; performance will depend on the indexes available on the table:

    select sales.*

    from (

    select distinct TerritoryID

    from [Sales].[SalesOrderHeader]

    )...

  • RE: Rebuild or DBREINDEX

    GilaMonster (4/30/2013)


    ScottPletcher (4/30/2013)


    When rebuilding a nonclustered index offline, SQL has to fully scan the clustered index.

    No it doesn't. That would be an inefficient way of running a rebuild. Both online...

  • RE: Rebuild or DBREINDEX

    GilaMonster (4/28/2013)


    1) DBCC DBREINDEX is deprecated, is included only for backward compatibility with SQL Server 2000 and should not be used any longer

    2) Up to you. Depends on your requirements...

Viewing 15 posts - 6,556 through 6,570 (of 7,616 total)