Forum Replies Created

Viewing 15 posts - 211 through 225 (of 541 total)

  • RE: Build query by using function

    In this case using "case" is the best way.  However, for more complex resolutions this would just be another table that holds the integer value and a corresponding value, which...

  • RE: Left pad field

    And to bum Chad's a little more:

    reverse(cast(reverse(REPLICATE('0', 5) + @value) as varchar(5)))

     

  • RE: VB function to SQL UDFunction - Working Days

    There is a set based way to do this, but first you need to set up a common SQL table called "Sequence":

     

    CREATE TABLE [Sequence] (

     [SequenceID] [int] IDENTITY (1, 1) NOT...

  • RE: Question regarding Sql server 2000 column names and aliases

    I don't understand, why don't you just use the following?

    select '<MDS>'

    select  1 as TAG,

              0 as parent,

              Q1.MedicationID as [M!1!MID],

              Q1.PatientID as [M!1!MName]

    from Medication Q1

    WHERE  Q1.MedicationID = @MedicationID

    FOR...

  • RE: Better way to Update only those values changed?

    Just doing the audit will suffice thou I do believe. Because you condition should be ON UPDATE for the table. Then you can compare changes over a period of time...

  • RE: Better way to Update only those values changed?

    The problem with IF UPDATE is that it cannot determine if the value actually changed only that the value was explicitly set.

    True...an additional check is needed

    If Update(Col1)

    BEGIN

     Insert  Audit (ColID, Value)

     Select...

  • RE: Better way to Update only those values changed?

    Whatever works for you.  In triggers you also have the option of testing groups by using:

    IF UPDATE (column1) OR IF UPDATE (column2)

    Triggers can be really tricky, but they are useful if...

  • RE: Its not a good idea to have metadata in the name!

    6) You look really stupid when you use a "tbl-" prefix in a language that has only one data structure.  Likewise "vw-" looks stupid since the user is not supposed...

  • RE: Better way to Update only those values changed?

    There are certain times I want to trigger something when the actual value changes, but not when the value is updated to itself.  For example, we have a web application...

  • RE: Sorting with Varchar Field

    May I add this to my site, so the users can decide for themselves which one to use?

    Sure, feel free to post it, but I think the patindex method is...

  • RE: Sorting with Varchar Field

    Yoda's advice is wise and illustrates the real problem, in that your column is an aggregate of two values.

    Frank, love the pattern searching for this.  My only gripe is that...

  • RE: The insult before Christmas

    Nobody makes fun of how we dress at my work, although they do complain about the smell sometimes (not about me, I take a sponge bath every month whether I...

  • RE: white spaces being filled in char(N) type field

    if you must use char and the spaces are giving you grief, you can use a "rtrim" function:

    select rtrim(cast('1' as char(5)))

  • RE: Comparing like data types for performance reasons

    I have seen problems when using implicit casting.  casting the 1 as a bit can be done explicitely (as in example 2) or implicitely (as in example 1).  Implicit casting...

  • RE: Indexed Views

    Quote: "Excellent article, however, I'm sure the value of indexed views can be communicated just as effectively without preaching to us about denormalization...which seems to be the author's real...

Viewing 15 posts - 211 through 225 (of 541 total)