Facebook Sign in | Join
Pushing database changes needn't be hard work with SQL Compare
Getting Started with Adobe After Effects - Part 6: Motion Blur
First Time? You can support us by signing up. It takes only 5 seconds. Click here to sign up. If you already have an account, click here to login.

TSQL Challenge 34 – Tricky Data

We are about to start the logic testing of TSQL Challenge 34. We have created a sandbox for the tricky testing and you can find it here.

Please take a look at the tricky data and expected results and let us know if you find anything incorrect. We will start the tricky testing by tomorrow.


Share

Comments

# re: TSQL Challenge 34 – Tricky Data

Monday, November 15, 2010 5:26 PM by Stefan_G

I get the following error when trying to run the script:

Conversion failed when converting the varchar value '70aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa' to data type int.

The error is caused by the statement

INSERT INTO TC34_Phrases(TextId, Data)

SELECT LEFT(text1,len(text1)-1),text2

FROM TC34_searches


# re: TSQL Challenge 34 – Tricky Data

Tuesday, November 16, 2010 2:08 AM by puzzles

Corrected.

Thanks Stefan for pointing this.


# re: TSQL Challenge 34 – Tricky Data

Tuesday, November 16, 2010 5:28 AM by Stefan_G

Since we obviously need to handle very long words, I think we should add the following to make sure that long words are really handled correctly:

Add this before COMMIT:

   INSERT INTO TC34_Phrases (TextID,Data) VALUES (101, 'a '+replicate(cast('b' as varchar(max)),9000)+' c')

   INSERT INTO TC34_Phrases (TextID,Data) VALUES (102, 'a '+replicate(cast('b' as varchar(max)),9000)+' '+replicate(cast('b' as varchar(max)),9000)+' c')

INSERT INTO TC34_Searches(Text1, Text2) VALUES ('a','c')

Change the expected result to this:

INSERT INTO @z(SearchID, TextID)

SELECT 1,9 UNION ALL

SELECT 2,44 UNION ALL

SELECT 5,83 UNION ALL

SELECT 11,101


Copyright © Rivera Informatic Private Ltd.