Forum Replies Created

Viewing 15 posts - 10,561 through 10,575 (of 13,461 total)

  • RE: ANYTHING THAT CAN HELP TRIM THE DATA FOR A GIVEN STRING...

    here's how i would do it with an CTE Tally Table:

    CREATE FUNCTION StripExtraSpaces(@OriginalText VARCHAR(8000))

    RETURNS VARCHAR(8000)

    BEGIN

    DECLARE @CleanedText VARCHAR(8000)

    ;WITH tally (N) as

    (SELECT TOP 1000000 row_number() OVER...

  • RE: ANYTHING THAT CAN HELP TRIM THE DATA FOR A GIVEN STRING...

    Declare @myString Varchar(256)

    SET @MY STRING = 'A COSMETOLOGIST uses knowledge to do things to a client`s hair. A HAIRAPIST uses knowledge to give a customer guidance...

  • RE: Row in a table is out of sequence or not

    in this case, you join the table against a copy of itself, and compare;

    here i'm assuming col1 is an identity field:

    the key is to compare with an offset of...

  • RE: Creating Logins

    i don't get to play with permissions much, so this post intrigued me;

    does db_datareader automatically bring in EXECUTE permissions on views

    or db_datawriter automatically bring in EXECUTE permissions on...

  • RE: sql problem

    i read this this morning and did not know what he was after;here's a couple of guesses:

    --square root

    select sqrt(81)

    --is 3 a natural root of 81? if % 3 = 0...

  • RE: strange foreign keys error

    i think only one of the two foreign keys should have the cascade options; that would resolve your circular reference issue, right?

    the second column should reference, but not delete related...

  • RE: IF condition in CURSOR

    you could also use a CASE inside the cursor for the evaluation:

    i assume your 1=1 would actually be a real test condition;

    SELECT VendorID, Name

    FROM Purchasing.Vendor

    WHERE PreferredVendorStatus =

    CASE

    WHEN MyCondition...

  • RE: Removing Spaces in varchar data

    why can't you just replace all spaces in the string?

    update yourtable set yourcolumn = replace(yourcolumn,' ','')

  • RE: Find data that has not changed for 5 days

    maybe with row number, if we can assume there is a data entry for every date.; from the data, i'm inferring that we are getting 5 or more business days,...

  • RE: Identity column Design Question

    also, you don't need to expose your Id to end users.

    another post a while back asked how to generate a combo varchar/number field, like AAA001 thru ZZZ999;

    would something like...

  • RE: Identity column Design Question

    why not just seed your identity at 10,000, so they could only infer from 10,000 to 99,999;

    an identity serves a much better purpose for indexing than a randome number ever...

  • RE: Find data that has not changed for 5 days

    well finding something that is older than 5 days is easy...but you have to know which column to compare;

    it took me much longer to build the CREATE TABLE and INSERT...

  • RE: restore adds collation to nvarchar columns

    wierd; I've always expected that restore gives the exact same data every time...restore it and the collation, which is in the databases sys.columns is restored to wherever it was.

    I haven't...

  • RE: Creating a Script/Batch File for END USER to Backup

    just following up;

    you'll want to test this two ways; after granting permissions to the procedure, just like i showed, log into SSMS as one of those users and run the...

  • RE: Creating a Script/Batch File for END USER to Backup

    Here's an example of how I've done it.

    First, I made sure there is a specific role created that will let people do it; mine is very simple, because a web...

Viewing 15 posts - 10,561 through 10,575 (of 13,461 total)