Forum Replies Created

Viewing 15 posts - 1,996 through 2,010 (of 2,171 total)

  • RE: @Local_Variable 8k Limit

    I don't understand. I get 1 and 8,000 as resultsets from above code.

    Changing code to

    declare @null varchar

    set @null = '2'

    exec('select 1' + @null)

    select len(replicate('x',15456)+replicate('x',160000))

    shows 12 and...

  • RE: Search entire database for date fields

    Let's only hope that the birthdates are stored in datetime/smalldatetime field, and not a varchar field.

     

  • RE: Primary Key Column

    select * from mydb..syscolumns where status & 0x80 = 0x80

    or

    sp_msforeachdb 'select * from ?.dbo.syscolumns where status & 0x80 = 0x80'

  • RE: How does one select EVERY Nth row from a table?

    Do you have a unique identity in the table?

    Then use

    DECLARE @NthRow INT

    SELECT  @NthRow = 5

    SELECT  *

    FROM    YourTable

    WHERE   YourIdentityColumn % @NthRow = 0

            AND YourIdentityColumn > 0...

  • RE: Running a script/proc in multiple DB''''s

    declare @db table (id int identity(0, 1), name sysname)

    insert  @db

      (

       name

       )

    select  name

    from  master..sysdatabases

    where  dbid > 4 -- remove system databases

    order by case when name = db_name() then 0 else 1 end

    July 4, 2006 at 6:52 am

    #647359

  • RE: Easiest query to find start of month

    Is that automatically color-coded or you do do it by hand?

    I'd like to know, because some examples I give here needs color-coding.

  • RE: Functions with internal Sorting - is it cached?

    It seems that the function returns the same string for every row. If that is the case, store the function string before and update later, as

    DECLARE @result VARCHAR(10)

    SELECT @result =...

  • RE: Functions with internal Sorting - is it cached?

    Yes, it does.

  • RE: TimeStamp from string ?

    Here is another approach, which I also believe as faster than Tim's suggestion. Preliminary testing shows that it is 4 times faster.

    CREATE FUNCTION dbo.fnTs2Bin8

    (

        @TS VARCHAR(23)

    )

    RETURNS BINARY(8)

    AS

    BEGIN

        DECLARE...

  • RE: Crosstab !?!

    Das ist ok. Ich werde Ihnen helfen, so viel wie ich kann. Nächste Woche ist mein letzter gewöhnlicher Job Woche vor dem Urlaub. Dann habe ich Urlaub seit 5 Wochen...

  • RE: Crosstab !?!

    Hello again Thomas!

    Here is your solution.

    declare @test-2 table (personalid tinyint, name varchar(3), loginid smallint, site varchar(2))

    insert @test-2

    select 50 ,'Tom', 1234, 'OE' union all

    select 50 ,'Tom', 5678,...

  • RE: Brutal Query

    I thought the idea was to return to ID where there was discrepancy, not the fk itself.

    My mistake. You have written an awsome query! Now it is mine turn to...

  • RE: Brutal Query

    Doesn't it only calculate if the number of fk for each id is different?

    What if ID 1 has fk 3 and 4, while ID 2 has fk 3 and 5?...

  • RE: Cursor Trouble looping through all records

    Well. That is something I don't se very often these days. An ID storage table. So I don't know if you benefit from my suggestions, but here is a SET-based...

Viewing 15 posts - 1,996 through 2,010 (of 2,171 total)