/ Published in: SQL

Creating index on huge text columns
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
CHECK this link FOR more information: http://www.mssqltips.com/tip.asp?tip=1868 Creating INDEX ON huge text COLUMNS: INDEX will be limited TO ONLY 900 characters so try TO CREATE ON 900 FIRST 900 bytes (UNIQUE CONSTRAINT OR INDEX) --Create the table IF OBJECT_ID('dbo.Unique900byte', 'U') IS NOT NULL DROP TABLE dbo.Unique900byte GO CREATE TABLE dbo.Unique900byte ( ReallyLongText VARCHAR(1000) NOT NULL , Unique_ReallyLongText AS SUBSTRING ( ReallyLongText, 1, 900) , CONSTRAINT UC_Unique900byte_Unique_ReallyLongText UNIQUE (Unique_ReallyLongText)) GO --Insert long text INSERT dbo.Unique900byte SELECT REPLICATE('A', 900)+ 'This is just a filler data' INSERT dbo.Unique900byte SELECT REPLICATE('B', 900)+ 'This is just a filler data' --Check the data SELECT * FROM dbo.Unique900byte
URL: http://www.mssqltips.com/tip.asp?tip=1868
Comments
