Forum Replies Created

Viewing 15 posts - 16 through 30 (of 77 total)

  • RE: escape characters in query

    Garadin's post points out why I like to put the Carriage Return/Line Feed into a variable constant rather than repeating it over and over. His last one is incorrect 🙂

    DECLARE...

  • RE: Updating table based on coalesce reults in where clause?

    Jeff Moden (10/4/2008)


    Although it has worked very well in the present and in the past, I wonder if folks understand that Updating an alias is actually an undocumented feature? 😉

    Nope,...

  • RE: Opinions on putting Insert and Update code into same proc

    It really depends on the situation. We do a lot of combined Update/Insert SPs to import data. We do this as the data we get is often mostly updates with...

  • RE: Problem with Tsql script

    Actually Jeff,

    I did think about that... And in fact our team is now doing a skunkworks project undertaking reading the dictionary from Erwin and putting it in the DB as...

  • RE: Updating table based on coalesce reults in where clause?

    To me, this looks like a great place to use a common table expression.

    Create the CTE with a union of all your left joined queries and then do a...

  • RE: One more thing about recreating foreign keys

    Creating a unique index is NOT the same as creating a Primary key.

    Change from doing this

    CREATE INDEX [PK_ptPhysicalExam]

    ON [dbo].[ptPhysicalExam] ([PEID] ASC)

    to

    ALTER TABLE dbo.ptPhysicalExam

    ADD CONSTRAINT...

  • RE: Problem with Tsql script

    Simple way is to use a cursor loop..

    DECLARE @SQL nvarchar(512),

    @C cursor

    SET @C = CURSOR FOR

    SELECT 'EXEC sp_dropextendedproperty

    ...

  • RE: Nested Cursors

    As Gail stated, it represents the last statement run. Often with nested cursors you want to set the value to a local variable so that it doesn't get over written...

  • RE: insert/update operation in same Stored Procedure is preferred or not ?

    I initially wrote my import SPs to use a flag that was set to check existence and then called one SP for inserts and another one for updates. Ultimately it...

  • RE: sqlquery

    That's what I get for not reading it 2 or three times I guess.

    This is certainly where your tally table would work great. 🙂

  • RE: Naming Guildlines / Standards

    Over my carreer I have worked at several different companies. They all had different standards.

    Here is what I currently try to do...

    Rule 1: No spaces in object names, or field...

  • RE: sqlquery

    Lets simplify this a little. If you only want the top 40 records... just use the following...

    SELECT TOP 40 {fieldlist}

    FROM Foo

  • RE: Creating user log-ins for a website with SQL Server

    garethmann101 (9/8/2008)


    Forgive me if the answer to this appears obvious, I am new to web programming with SQL Server.

    I am building a website that will have many users, they must...

  • RE: Compare two IMAGE fields

    Convert the image field to varbinary to do your comparison.

    create table foo

    (

    img image

    )

    go

    select *

    from foo a, foo b

    WHERE...

  • RE: Slow query.

    It would perform better if you correlated the sub query or used a left join.

    SELECT *

    FROM dbo.service_type_dim std

    WHERE std.service_type_code not in

    (

    SELECT DISTINCT...

Viewing 15 posts - 16 through 30 (of 77 total)