Hello,
I have a requirement where a table has ItemId & AuthenticationString (default to replicate('0',8000)) and other table has ItemId & CodeNumber. If in second table there exists a CodeNumber for a ItemId then AuthenticationString should have it as 1 for that position of CodeNumber.
CREATE TABLE ItemId (ItemId INT,AuthenticationString VARCHAR(8000)) CREATE TABLE CodeNumber (ItemId INT,CodeNumber SMALLINT) INSERT INTO ItemId SELECT 1,REPLICATE('0',8000) INSERT INTO CodeNumber VALUES (1,1) INSERT INTO CodeNumber VALUES (1,3) INSERT INTO CodeNumber VALUES (1,7) INSERT INTO CodeNumber VALUES (1,8)
output for this example should be '10100011000000000............' in AuthenticationString field. I am doing now by while loop & STUFF function. I am using SQL Server 2005.
Thanks in Advance.