Categories
-
Recent Posts
Recent Comments
Category Archives: SQL
Dynamic MS SQL 2005 Stored Procedure Parameters
I had a function in my .NET application, that needed to do a search with an unknown number of parameters. for example: select * from tbl where x=1 or x=2 or x=3 or x=4 Solution: Pass in a comma seperated … Continue reading
Posted in .Net, SQL
Leave a comment
SQL JOINs
Assuming you’re joining on columns with no duplicates, which is by far the most common case: An inner join of A and B gives the result of A intersect B, i.e. the inner part of a venn diagram intersection. An … Continue reading
Posted in SQL
Leave a comment
Text was truncated or one or more characters had no match in the target code page.
I’ve run into this problem many many times already. here is a workaround? 1. save the excel as either tab delimited or pipe delimited. (the problem here is that it ads quotes to the import, but thats easily fixable later….) … Continue reading
Posted in SQL
Leave a comment
for xml explicit
SELECT 1 AS tag, NULL AS parent, user_id AS [li!1!title], name AS [li!1] FROM t_users FOR xml explicit comes out as: <li title="1">user Name 1 </li> <li title="2">user Name 2 </li> <li title="3">user Name 3 </li> etc.
Posted in SQL
Leave a comment
useful SQL queries
Find all users that are in tblUser table but are not in tblTransaction (very useful if there’s a foreign key issue) SELECT USER_ID FROM tblTransaction WHERE USER_ID NOT IN (SELECT ID FROM TBLUSER) Now this one is used when you … Continue reading
Posted in SQL
Leave a comment