CAST Varchar To Integer in T-SQL

CAST(CASE WHEN ISNUMERIC(variab)=1 THEN variab ELSE 0 END AS INT)

This changes all non numeric string to 0 when deal with not so cleaned data.

In SQL Query, How to Compare Across Different Rows

In SQL query, it is easy to compare values in different columns for same row. However, when compare value at column_A of Row 1 to the values at column_B of Rows 2 to 3, it would be hard. Sure, you always can write the cursor to process rows one by one. Here is a quick way: INNER JOIN this table by itself, you would get following rows: New row 1 = old row 1 and 1 New row 2 = old row 1 and 2 New row 3 = old row 1 and 3 New row 4 = old row 2 and 1 New row 5 = old row 2 and 2 New row 6 = old row 2 and 3 New row 7 = old row 3 and 1 New row 8 = old row 3 and 2 New row 9 = old row 3 and 3 Now you will be able to compare column_A and column_B at new rows 2 to 3, which is what you want. Just remember to eliminate row 1 and row 4 to 9.

Set MS Access As An Interface to Access Other Database

MS Access can act as an stand alone database or an interface to access ther database, or a database consists of both local tables and linked tables. To set up such links after you have been granted the access to database from DBA, do follows:

1. In Windows' Administrative Tools, click Data Source (ODBC) to set up the link.
2. In MS Access, Click External Data menu.
3. In Import, click More to find out the ODBC Database.
4. Select all tables you need.

SEO Tips

Put following scripts in HTML Head:

‹meta content='DESCRIPTION HERE' name='description'/>
‹meta content='KEYWORDS HERE' name='keywords'/>
‹meta content='AUTHOR NAME HERE' name='author'/>

Keywords need to be separated by comma.

Several people were filling with just the keywords in the description. DON'T DO THAT. Google and other search engines will ban your site from the search engines list if you did so. And also don't repeat the keyword more than 3 times.


http://www.bloggertricks.com/2007/12/adding-meta-tags-to-bloggerblogspot.html

Update with Values from Fields in Another Table in Ms Access

Ms Access uses Jet engine, which is different in somewhere from T-SQL. Here is the way to update a field in Table_1 with the values from field in Tab_B:

UPDATE Table_1
INNER JOIN Tab_B ON Tab_B.Key_Field_In_B = Table_1.Key_Field_In_1
SET Table_1.Target_Field = Tab_B.From_Field
WHERE Tab_B.Condition_Field = 'Something'

Sometimes, you may still get error message: Operation must use an updateable query. Most likely, the join key of either table are not unique key, as a result, the join action does generate more rows than that in Table_1. Since this is an update action, this does caused the error.


http://www.fmsinc.com/microsoftaccess/query/snytax/update-query.html

Fast Redirect Method

Page redirection is used to redirect/forward a page visitor to another page, such as when a pageor

* JavaScript Redirect - preferred method
* Timed Redirect with JavaScript
* meta-tag - provided for reference but not the preferred method.

Hands on experiences show following method is the fast, if that is what you want:

‹script language="JavaScript"›
; window.onload = function()
{ ; window.location.replace("http://yourdomain.com/")
}
‹/script›


http://grizzlyweb.com/webmaster/javascripts/redirection.asp#version2

Add Sequential Number Column in SQL Query Result

To add a column with sequential number in SQL query can be done through add a sequence numbered table contains a link key or directly compose in query. The first method sounds unwise, but if the query itself is too complicated, it might not be a bad idea.

The second method is:

SELECT
(
SELECT COUNT(au_id)
FROM Mytable1 AS x
WHERE x.au_id <= y.au_id
) AS Sequence
, au_id
, something_else
FROM Mytable1 AS y
ORDER BY au_id

This constrains here are:
1. Field au_id must be number.
2. The query itself can’t be too complicated.
3. If Mytable is from another query, if won’t work properly in some systems, such as SQL Server.


http://www.databasejournal.com/features/mssql/article.php/3373861/Auto-Number-and-Cumulative-sum-in-SQL-Server-Query-results.htm

Labels