Tag Archives: sql

Remove Characters in String T-SQL with No Loop Part 2

Okay, expanding on what I did yesterday. I Built a table, called ExclusionList with one field, ExcludedText E.g. Then created a function: You can then use like this: Advertisements

Posted in Programming | Tagged , , , , | Leave a comment

Remove Characters in String T-SQL with No Loop

Ok, I’ve seen many ways to do this using loops, but nothing in plain T-SQL Let’s say we have a string that may contain illegal characters, in my case it was project identifiers that needed to be used as file … Continue reading

Posted in Programming | Tagged , , , , , , | Leave a comment

Loading Data into a DataReader and Looping Through Records OLEDB / C#

Just a quick example of loading data into a data reader using C#. My data source is MS SQL Server in this case, although you would just need the correct OLEDB connection string to use any other data source. Couple … Continue reading

Posted in Programming | Tagged , , , , , | Leave a comment

Search for Value in Multiple Columns SQL Server T-SQL

Having to write some SQL SELECT’s on some un-normalized tables left me thinking there has to be a tidier way. I started with: (@SCAN_ID is a variable declared earlier) I ended up with: Maybe not a massive improvement, but personally … Continue reading

Posted in Programming | Tagged , , , | Leave a comment

Browse for SQL Server 2008 R2 Installation Media

When running the SQL Server Installation Centre I was receiving the above error. This seems to be caused by the software being installed to a temp folder which is subsequently deleted post install. Mine had been installed from a folder … Continue reading

Posted in Programming | Tagged , , | 2 Comments

Multiple OR’s in T-SQL WHERE Condition SQL Server

Just been rewriting some SQL Server stored procedures for a client. There were a lot of SELECT statements like the one below: I’ve seen this quite a few times, and I’m not suggesting this is wrong, however I find that … Continue reading

Posted in Programming | Tagged , , , | Leave a comment

Parametrised SQL Server Stored Proc From ASP.net / C# / OLEDB

Lets assume that we have a stored procedure that is defined in the following way, it doesn’t really matter what the actual body of the SQL is: We want to be able to call this procedure from an ASP.net page … Continue reading

Posted in Programming | Tagged , , , , , , , , , | Leave a comment

Populating Windows Forms ComboBox from SQL Server using OLEDB and DataTable

For the database connection, and populating the DataTable see my post: Populating ASP.net DropDownList from SQL Server using OLEDB and DataTable Hopefully you have now connected to your database and populated your DataTable. Now all we need to do is … Continue reading

Posted in Programming | Tagged , , , , , , , | Leave a comment

Populating ASP.net DropDownList from SQL Server using OLEDB and DataTable

Firstly we need to ensure that we have referenced System.Data.OleDb in order to connect to the Database. Now the database connection: NB: for connection string help / information this is a great resource http://www.connectionstrings.com/ Now we have our open database … Continue reading

Posted in Programming | Tagged , , , , , , , , | Leave a comment

Select a range of records from a dataset in T-SQL

This is a way to filter out a numbered range using T-SQL.  I.e. if you wanted to select the 100th – 110th row from your dataset. Firstly use the OVER statement to add row numbers (as ROW_NUM column) to your … Continue reading

Posted in Programming | Tagged , , | Leave a comment