Forum Replies Created

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

  • RE: Link to Resource - Script is not valid

    Thanks, hope it still works , and all can enjoy.

     



    Once you understand the BITs, all the pieces come together

  • RE: Urgent SQL view help required

    Yes, you are correct in that a VIEW has to be a SELECT statement. I often think of a T-SQL script to do the work when "CREATE VIEW..." is not...



    Once you understand the BITs, all the pieces come together

  • RE: How to "exclude" a column for some records in XML result?

    Thanks for the reply... In the mean time, I noticed that at least when I use "...for XML AUTO, Elements", the columns where all records in set have a NULL...



    Once you understand the BITs, all the pieces come together

  • RE: Urgent SQL view help required

    Changing things can make a big difference....

    Anyway, I noticed that you have an INNER JOIN on [dbo.tcorder] without an ON clause ??? This should give you an error ???? (same...



    Once you understand the BITs, all the pieces come together

  • RE: General UDFs to emulate BITTEST(), BITSET() ?

    Only thing I might change is instead of

      2

    Use

      Convert(BigInt, 2)

    That will insure the POWER() result can be a BigInt. Perhaps even make the @nPosition a BigInt also ???. You...



    Once you understand the BITs, all the pieces come together

  • RE: General UDFs to emulate BITTEST(), BITSET() ?

    You are doing string manipulation to get your results. this is fine for readability, but if you need to call these functions for many records in a result set, it...



    Once you understand the BITs, all the pieces come together

  • RE: General UDF to emulate IIF() ?

    Ya, there may be ways around doing what you want, but all the things I can think of are a lot harder than writing a quick UDF search & replace...



    Once you understand the BITs, all the pieces come together

  • RE: General UDFs to emulate BITTEST(), BITSET() ?

    Ilmar, a couple of things... You may want to make sure all the integers are BIGINTs for dealing with bits accessed with big numbers.

    And check out SQLServer Central Article at...



    Once you understand the BITs, all the pieces come together

  • RE: General UDFs to emulate BITTEST(), BITSET() ?

    nExpression1 = nExpression1 ^ Power( 2, nExpression2) -- clear Bit nExpression2

    (Bitwise Exclusive OR)



    Once you understand the BITs, all the pieces come together

  • RE: General UDF to emulate IIF() ?

    You might be little out-o-luck, as far as pursuing it with a UDF, since you can not have dynamic SQL code in a T-SQL UDF



    Once you understand the BITs, all the pieces come together

  • RE: Importing data from flat file to SQL Table

    Here is a little snippet from some of my code... may help you get started...

    Bulk Insert {TableName|ViewName} From '{FileName}'

      With ( CODEPAGE = 'RAW',

       DATAFILETYPE = 'char',

       ROWTERMINATOR = '\n',

       FIELDTERMINATOR =...



    Once you understand the BITs, all the pieces come together

  • RE: General UDF to emulate IIF() ?

    You can use T-SQL's CASE sturucture

    SELECT CASE WHEN shipdate < getdate() THEN 'shipped' ELSE 'pending' END as status



    Once you understand the BITs, all the pieces come together

  • RE: General UDFs to emulate BITTEST(), BITSET() ?

    Case When nExpression1 & Power( 2, (nExpression2 + 1)) = 0 then 0 else 1 end -- returns 1 bit set

    nExpression1 = nExpression1 | Power( 2, (nExpression2 + 1)) --...



    Once you understand the BITs, all the pieces come together

  • RE: Importing data from flat file to SQL Table

    Personally I'd use a T-SQL with BULK INSERT.

    As for "testing" the file, check out this function I posted a while back with help from this forum... http://www.sqlservercentral.com/scripts/contributions/1028.asp



    Once you understand the BITs, all the pieces come together

  • RE: UPDATE From Another Table With CASE Statement

    How about something like....

    UPDATE T1

      SET T1.StatusID =

        CASE WHEN T2.Code = 1 THEN 3

             WHEN T2.Code = 2 THEN 8

             WHEN T2.Code = 3 THEN 13

        END

    FROM table_1 T1

    INNER...



    Once you understand the BITs, all the pieces come together

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