Forum Replies Created

Viewing 15 posts - 2,521 through 2,535 (of 3,544 total)

  • RE: EXEC & sp_executesql

    As written you must use

    EXEC sp_executesql

    or do you mean that the sql works with EXEC but not sp_executesql ?

    Trigger, yes sp_executesql will cache query plans but if I remember...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Error trapping in a User Defined Function

    Not really done much with UDF's or returning tables from them but you could return the error in the output table like this

    Create Function dbo.FnGetDateDiffs2

    (@StartDate DATETIME, @EndDate DATETIME)

    RETURNS @retElapsed TABLE...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: PK or Composite Key question...

    In addition to what has been stated, with the DDL posted, only Place_ID can be part of a primary key as all columns in a primary key have to be...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Data conversion during import

    Not pretty but.....

    DECLARE @value char(7)

    SET @value = '000123Y'

    SELECT SUBSTRING('0-',PATINDEX('%[A-Z]%',SUBSTRING(@value,7,1))+1,1)

    + SUBSTRING(@value,1,5)

    + '.'

    + SUBSTRING(@value,6,1)

    + SUBSTRING('01234567890123456789',CHARINDEX(SUBSTRING(@value,7,1),'0123456789.......GTY'),1)

    you can use the result as is or CAST it if...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Concatenate column across multiple rows

    Without using a function but using a while loop

    make sure ConCatField is NULL before running this

    DECLARE @upd int

    SET @upd = 1

    WHILE (@upd > 0)

    BEGIN

    UPDATE t

    SET...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: How convert char ddmmyyyy to date dd.mm.yyyy?

    Or

    STUFF(STUFF('06102004',5,0,'.'),3,0,'.')

    and to type datetime

    CAST(STUFF(STUFF('06102004',5,0,'.'),3,0,'.') as datetime)

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: OLE DB Error

    Cannot remember if the error number is the same but I sometimes get the dts message and step failed if there is a data conversion problem (ie date). If the...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Really wierd Transaction? issue

    Plus, it would better written as

    IF @NewClosedDetail IS NOT NULL

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: import (replace data) in Table

    quoteexport (dts) the table data to a new (temp) table and then truncate the original before importing (dts)...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: SQL 7 to SQL 2k mismatched collate and sort order issue

    I agree with hoo-t

    We had the same problem with one server and successfully rebuilt master and changed the collations of the database.

    There is a bug with rebuildm, see

    http://support.microsoft.com/default.aspx?scid=kb;en-us;273572

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Stored Procedure issues

    You need to add this line

    SET @MRevAmount = null

    before

    select @MRevAmount = MonthlySumRev, @QTRevAmount = QuarterTotRev, @QARevAmount = QuarterAvgRev

       from ##TEMPTOTALS where organizationid=@OrganizationID and [Year]=@Year and [Month]=@Month

    because if there is...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: import (replace data) in Table

    Yes Index Names have to be unique in a database and a Primary Key is an Index.

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Left Padding is there any built in functions

    LEFT(ISNULL(REPLICATE(@Char2, @n - DATALENGTH(@Char1)),'') + @Char1,(CASE WHEN @n < 0 THEN 0 ELSE @n END))

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: import (replace data) in Table

    When you renamed the table the priamry key will remain with the table and have the same name when it was created (either by the system or by you). Names...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: foreign key information

    Look up sp_fkeys in BOL (Books Online)

    This will produce sql to find foreign keys in current database

    SELECT 'exec sp_fkeys '+name FROM sysobjects WHERE type = 'u'

    copy and paste results into...

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 2,521 through 2,535 (of 3,544 total)