Oracle Naming Conventions

When designing a database it’s a good idea to follow some sort of naming convention. This will involve a little thought in the early design stages but will save significant time when maintaining the finished system.

It’s less important which exact conventions you choose to follow – but this page has a few suggestions.

The benefits of using a naming convention are more to do with human factors than any system limitations – but this does not make them any less important.

Continue reading “Oracle Naming Conventions” »

Entity Mapping: Table-per-type and Table-per-hierarchy

In the object world, Inheritance is natural thing. However the flat data model cannot be easily mapped to the hierarchy object model. Entity Framework provide TPT and TPH to solve this problem.  

Continue reading “Entity Mapping: Table-per-type and Table-per-hierarchy” »

Determining if a Date is a Weekday in T-SQL

create function fn_IsWeekDay ( @date datetime ) returns bit as begin declare @dtfirst int declare @dtweek int declare @iswkday bit set @dtfirst = @@datefirst – 1 set @dtweek = datepart(weekday, @date) – 1 if (@dtfirst + @dtweek) % 7 not in (5, 6) set @iswkday = 1 –business day else set @iswkday = [...]

[TSQL]How to get list of Table in MS-SQL

USE [TABLE_NAME] SELECT * FROM sys.Tables ORDER BY NAME

List all the Stored Procedures of a Database and their Definitions using T-SQL in SQL Server 2005/2008

SELECT obj.Name as SPName,

modu.definition as SPDefinition,

obj.create_date as SPCreationDate

FROM sys.sql_modules modu

INNER JOIN sys.objects obj

ON modu.object_id = obj.object_id

WHERE obj.type = ‘P’