Thursday, March 25, 2010

[MSSQL] Run Procedure With Select

To run stored procedure using select, but the parameter is compulsory.

SELECT PROCEDURE_NAME(PARAM1,PARAMx)

Wednesday, March 24, 2010

[MSSQL] Alter Table

ALTER TABLE table

ADD column_name
data_type [ ( size ) ]
[ DEFAULT value ]
[ NULL | NOT NULL ]
[ PRIMARY KEY | UNIQUE ]
[ CONSTRAINT constraint_name ]

ALTER COLUMN column_name
data_type [ ( size ) ]
[ ( precision [ , scale ] ) ]
[ NULL | NOT NULL ]

DROP COLUMN column_name | [ CONSTRAINT ] constraint_name

Friday, March 12, 2010

[MSSQL] Enable sa Login

alter login sa enable;
go
alter login sa with password = ''

[IIS] HTTP Error 404 in IIS 6.0

Error message 1
HTTP Error 404 - File Not Found

Error message 2
HTTP Error 404- File or Directory not found

Resolution:
1. Open IIS Manager, expand the master server node (that is, the Servername node), and then select the Web service extensions node.
2. In the right pane of IIS Manager, right-click the extension that you want to enable. In this example, this is Active Server Pages.
3. Click to select the Allow check box.

Please refer to http://support.microsoft.com/kb/315122

Tuesday, February 16, 2010

[.Net] Auto hide radio button in Grid RowDataBound event

If e.Row.Cells(7).Text = " " Then
rbl.Visible = False
Else
rbl.Visible = True
End If

Thursday, January 14, 2010

[MSSQL] Format Time hh:mm:ss

Format the date to get time in 24 hours format.

select convert(varchar,getdate(),108)

[.Net] Vertical column to horizontal column

declare @columns1 VARCHAR(max)
select
@columns1=coalesce(@columns1 + ', ', '') + ('tbl1.' + cast(tA1.column_name AS varchar(100)))
from (
select * from table_field_name
where table_name='table1'
) as tA1
inner join
(select table_name, column_name from (
select * from table_field_name
where table_name='table2'
) as ta) tA2
on tA2.column_name=tA1.column_name