Archive for the 'Database' Category

MSSQL - Useful query for my reference

This will me my reference of SQL statement. I will update this post if I find anything that I feel useful for me..and for you.
1. Check for temporary table and Drop table if exist.

IF object_id(’tempdb..#myTempTable’) IS NOT NULL drop table #myTempTable

2. Convert SQL string to HEX

select CONVERT(varbinary(100),’select getdate() as MyDateInHex’)

If you’re new [...]

Download Malaysia Postcode

While everyone is talking about fatwa on yoga , I’m here to share Malaysia postcode that I use to do some of my analysis work. (which I also get it from someone else. )
You will be expecting the file to be in this CSV format.

This is the only postcode list I have. If you [...]

500+ FREE Database Model

Do you need a sample database to kick-start your application development for FREE ?

Here you go. 500+ FREE Data Model

Author’s note: None of the Models is the complete and final solution in its area, but any of them can be added to easily and quickly to meet a specific requirement.

Till then…adios.
ps:I hope [...]

MSSQL - Date Manipulating

By default, result for select getdate() in MS-SQL will be something like below:
getdate()
————————-
2008-09-09 15:01:47.340

CONVERT function can be use to manipulate the date format as per our need.
Using CONVERT:
CONVERT ( data_type [ ( length ) ] , expression [ , style ] )

example:
select CONVERT(varchar(25),getdate(),100)
————————-
Sep 9 2008 3:04PM
Below are the lists of style/format for reference :


AWSOM Powered