Forum Replies Created

Viewing 15 posts - 1 through 15 (of 161 total)

  • RE: Sending multiple rows to the Database from an Application: Part I

    The code I use to split out delimited list is:

    create function [dbo].[Split](@value nvarchar(max), @delimiter varchar(20))

    returns @results table (id int identity(1, 1) primary key, value nvarchar(max))

    as

    begin

    declare @p1 int,

    @p2 int

    -- ensure value...

  • RE: Service Broker: Poison Message Handling

    I have attempted to use profiler, but it does not seem to raise an error number (btw, where have all the server messages goine in 2005??).

    From what I have managed...

  • RE: substring or like

    The data in calculated columns will not add to the storage requirement for the table - it is in effect virtual data.  However, by creating the index you will persist...

  • RE: substring or like

    Just specify the Calculated column in the where clause and the query optimiser should choose the appropriate index.  You can check by looking at the Execution Plan.

    Beware that creating too...

  • RE: substring or like

    If this was something you were going to be regularly searching for, you could create a calculated column with a formula of:

    substring(PartCode, 1, 4)

    Then build an index on this calculated...

  • RE: queries problem

    Query 1

    select friends_name

    from freinds

    where movie_name='titanic' and borrowed_date<getdate()

    Query 2

    select friends_name, datediff(d, borrowed_date, getdate()) as DayCount 

    from friends

    where returned_date is null and borrowed_date<getdate()

    Hope this helps

  • RE: Translate this in a stored procedure

    Sorry oversight in previous post that newid() will generate a hex value (i.e. only A-F).

    You can use a view to generate the random number and a generic function to construct a...

  • RE: Translate this in a stored procedure

    Why not just use the newid() function to generate the random string.

    declare @MyCode varchar(6)

    while @MyCode is null or @MyCode like '%[I,O]%'

        set @MyCode  = left(convert(varchar(40), newid()),...

  • RE: Need trigger to split 1 filed to 4

    Tertius

    If you change you code as highlighted below, your code will work for multiple record inserts - it currently does not.

    CREATE TRIGGER trig_Split

    ON dbo.SMS

    FOR INSERT

    AS

    UPDATE SMS Set

    Part1 = substring(SMS.SMSMessage+ '$',...

  • RE: Need trigger to split 1 filed to 4

    Using mkeast's example (with some minor modifications) you can use the following to test which of these triggers work for multiple rows and which do not.

    CREATE TABLE SMS

    (

      id...

  • RE: Need trigger to split 1 filed to 4

    Farrell

    Judiths code would not work if there are more than a single row inserted (i.e. by using an INSERT.... SELECT.... statement).

    The part of the code which SET's all the parameters...

  • RE: Need trigger to split 1 filed to 4

    My last post relates specifically to Judith solution, but in hind sight Farrells solution falls foul of the same problem since the @location and @message variables to not take account...

  • RE: Need trigger to split 1 filed to 4

    I am afraid that  your solution does not take account of the fact that when a trigger fires it can relate to a set of data (i.e. more than one...

  • RE: Need trigger to split 1 filed to 4

    I know this script uses a cursor, which is not ideal within a trigger, but I think you will find that it should work.....

    create trigger SMS_ITrig on SMS...

  • RE: Printing in Query Analyzer

    Although only a text editor, you could consider using TextPad - it allows you to use a syntax file to markup the text in the same colours as QA, and...

Viewing 15 posts - 1 through 15 (of 161 total)