Forum Replies Created

Viewing 15 posts - 61 through 75 (of 94 total)

  • RE: SQL function to Decode a Bitmask?

    I just wrote this, but it should work.

     

     

    create function dbo.fnBitMaskToInt

    (

     @Bits varchar(64)

    )

    returns int

    as

    begin

     declare @Value int

     declare @i int

     declare @length int

     declare @CurChar char

     set @value = 0

     

     set @length = len(@bits)

     set @i = 0

     while @i...

  • RE: Defining a Default Storage Format for Phone# and SSN

    AJ is correct, but are you looking to store the dashs?  If you are and you want to enforce it to always be the same, you'll need to manage user...

  • RE: Insert and Update Triggers

    Fair enough.  Also, in case you want to track who deletes using triggers a delete trigger allows access to the table deleted.

    select @recordkey = [keyfieldname] from deleted would give you...

  • RE: Insert and Update Triggers

    There is a special table during inserts/updates/deletes available in triggers.  During an update/insert you can perform something like the following:

    declare @RecordKey int

    select @RecordKey = [KeyFieldName] from inserted

    update [tablename] set userlastchanged...

  • RE: I''''ve just deleted my client DB

    It appears to be a copy of a script generated from a DTS where the DTS is supposed to drop the destination object if it exists because a new object...

  • RE: Transaction Logs filling up

    Does your maintenance plan backup the logs and then truncate them?  I believe that should fix the issue.  If it doesn't and you really, really, really, want to get rid...

  • RE: Data Types and Stored Procs

    8000 is the maximum of varchar data types as you obviously know.  A text field type does not have this limitation, but if your email stored procedure calls the xp_sendmail...

  • RE: Adress interval into multiple records

    OK.  I believe this will do the trick.  Not having the tables I really didn't have a way to debug the code, so you may need to tweek it a...

  • RE: Adress interval into multiple records

    no love on the screen dump

    Try cutting and pasting the output of query analyzer

  • RE: Adress interval into multiple records

    Are the values for the intervals within the database or are they assumed values? 

    If they are assumed values, is the interval always the same?

    If they values are somewhere in...

  • RE: Adress interval into multiple records

    create your new table (I'm assuming you know how to do that).

    insert into tNewTableName

    (ID, roadname, house_number)

    select ID, roadname, house_number_start

    union

    select ID, roadname, house_number_end

     

  • RE: Third Highest Salary

    Another way would be the following

    select min(salary) as Salary from (select top 3 salary from employees order by salary desc) tSalaries

  • RE: Return a unique row

    I know I'm speaking for RonM9 here but I took the problem to mean that the combination the two records of

    1 2

    2 1

    are the same relationship.  This is the...

  • RE: Return a unique row

    cowboy's solution will return a single row.  I think he misunderstood your question.  I would recommend noeld's suggestion.  I think it will be a better performing sql, check the execution...

  • RE: Return a unique row

    very nice.

Viewing 15 posts - 61 through 75 (of 94 total)