Forum Replies Created

Viewing 15 posts - 5,791 through 5,805 (of 6,036 total)

  • RE: Extracting a date from a string

    The best way to work it out is to create scalar UDF for searching date value within supplied string.

    You can have iterations inside UDF, do multiple comparisons, but your select...

  • RE: INSTEAD OF Insert Trigger and @@IDENTITY

    If to do it properly...

    ----------------------------

    Declare @LastId int

    Declare @Rowcnt int

    Declare @ErrorNo int

    SET @Rowcnt = 0

    SET @ErrorNo = 0

    INSERT INTO @NewProject (all columns but Id)

    SELECT .....

    FROM inserted

    WHILE @Rowcnt = 0 AND @ErrorNo...

  • RE: Alter Table Problem

    What is this:  alter table kpuser.tbl add @pos varchar(50) ?

    Probably you want just insert value?

    INSERT INTO kpuser.tbl

    SELECT @pos

     

  • RE: INSTEAD OF Insert Trigger and @@IDENTITY

    OK, what abot 10 rows to insert?

    Can you show the INSERT statement?

  • RE: Datetime shenanigans

    I just don't use to convert datetime to varchar.

    The only place I need DATEFORMAT is reading from flat file. And here I use a lot of tricks, and I collect...

  • RE: Datetime shenanigans

    And you must be sure the SP you are creating will never been called from another SP having SET DATEFORMAT ... inside.

  • RE: INSTEAD OF Insert Trigger and @@IDENTITY

    So, you end up with cursor.

  • RE: Searching for all the words

    Unfortunately

    where word like '%monitors%sensors%LCD%'

    and

    where word like '%sensors%monitors%LCD%'

    will return different results.

    If to modify govinn's prescription:

    create table #x ( word varchar(40) not null )

    insert...

  • RE: Datetime shenanigans

    Because in 'dmy' day cames before month!

    Sounds silly, but that is it.

    And 'British' settings do not guarantee 'dmy' dateformat. 'dmy' is DEFAULT for 'British', but you can set any option without...

  • RE: Datetime shenanigans

    It's not about language.

    It's about SET DATEFORMAT.

  • RE: INSTEAD OF Insert Trigger and @@IDENTITY

    1. Is not a problem. Just use

       SET TRANSACTION ISOLATION LEVEL SERIALIZABLE

    2. Can you write SQL statement to insert 10 rows from inserted using your way?

        No cursors, please.

    And if...

  • RE: Datetime shenanigans

    Always use explicit conversion:
     
    UPDATE table

    SET

    datetime_field = convert(datetime, '2005-11-21', 120)

     
  • RE: INSTEAD OF Insert Trigger and @@IDENTITY

    Create table #NewProject (

       Id int IDENTITY(1,1),

       ....

         )

    declare @LastId int

    INSERT INTO @NewProject (all columns but Id)

    SELECT .....

    FROM inserted

    SELECT @LastID = MAX(ProjectId) from TATMChangeHistory.dbo.tblProject

    SET IDENTITY_INSERT TATMChangeHistory.dbo.tblProject ON

    INSERT INTO TATMChangeHistory.dbo.tblProject

            ...

  • RE: Updating Error -- Using Convert Function

    DO NOT CONVERT DATETIME TO VARCHAR!

    DO NOT CONVERT DATETIME TO VARCHAR!!!

    DO NOT CONVERT DATETIME TO VARCHAR!!!!!

    CallTime = srawlogout - srawlogin

    That's it.

    If you need inly time portion of a datetime...

  • RE: Server error HURRY!!

    BTW,

    LEN( RTRIM( @INPUT_STRING ) ) = LEN( @INPUT_STRING )

     

     

Viewing 15 posts - 5,791 through 5,805 (of 6,036 total)