Using RegEx in SQL Server

You do not need to interact with managed code, as you can use LIKE: As your expression ends with + you can go with ‘%[^a-z0-9 .][^a-z0-9 .]%’ EDIT:To make it clear: SQL Server doesn’t support regular expressions without managed code. Depending on the situation, the LIKE operator can be an option, but it lacks the flexibility that regular expressions provides.

What is the maximum characters for the NVARCHAR(MAX)?

The max size for a column of type NVARCHAR(MAX) is 2 GByte of storage. Since NVARCHAR uses 2 bytes per character, that’s approx. 1 billion characters. Leo Tolstoj’s War and Peace is a 1’440 page book, containing about 600’000 words – so that might be 6 million characters – well rounded up. So you could stick about 166 copies of the … Read more

What is the difference between char, nchar, varchar, and nvarchar in SQL Server?

Just to clear up… or sum up… nchar and nvarchar can store Unicode characters. char and varchar cannot store Unicode characters. char and nchar are fixed-length which will reserve storage space for number of characters you specify even if you don’t use up all that space. varchar and nvarchar are variable-length which will only use up spaces for the characters you store. It will not reserve storage like char or nchar. nchar and nvarchar will take up twice as much storage space, so … Read more

How do you open an SDF file (SQL Server Compact Edition)?

Download and install LINQPad, it works for SQL Server, MySQL, SQLite and also SDF (SQL CE 4.0). Steps for open SDF Files: Click Add Connection Select Build data context automatically and Default (LINQ to SQL), then Next. Under Provider choose SQL CE 4.0. Under Database with Attach database file selected, choose Browse to select your .sdf file. Click OK.