Thursday, January 15, 2009

Loading external javascript files in web page

External java script files will be included into web page by using <script> tag. 

Here is the example of including external java script file in web page. 

<script src="Cmmon.js" type="text/javascript"></script> 

Script tag should be closed properly. The following example is wrong way of including external java script files. 

<script src="Cmmon.js" type="text/javascript" />

With the above statement only one javascript file will be loaded into page, when you try to load multiple java script files.

this._form is null javascript error

Here is one scenario which I had faced in my application for this issue. 

I had included some of the external java script files in my application with below syntax. 

<script src="Common.js" type="text/javascript" /> Wrong 

It is wrong the script tag should be closed with “</script>” instead of "/>". Then only all the scripts will be loaded into the page properly. 

<script src="Common.js" type="text/javascript"></script> Correct

Sunday, January 4, 2009

SQL Statement for getting the list of tables which has identity columns

SQL statements to get the list of tables which has IDENTITY columns.

Statement 1:
-------------
SELECT 
     QUOTENAME(SCHEMA_NAME(t.schema_id)) + '.' + QUOTENAME(t.name) AS TableName 
FROM sys.columns AS c  
    INNER JOIN 
    sys.tables AS t  
    ON t.[object_id] = c.[object_id] 
WHERE c.is_identity = 1

Results
--------
[dbo].[Table1]
[dbo].[Table2]
[dbo].[Table3]

Statement 2:
-------------
SELECT T.NAME AS TableName FROM sys.columns AS c
    INNER JOIN sys.tables AS t
ON t.[object_id] = c.[object_id] WHERE c.is_identity = 1

Results
--------
Table1
Table2
Table3