Monday, September 17, 2012

SELECT TRIGGERS LIST IN A DATABASE IN SQL SERVER


SELECT
     sysobjects.name AS trigger_name
    ,USER_NAME(sysobjects.uid) AS trigger_owner
    ,s.name AS table_schema
    ,OBJECT_NAME(parent_obj) AS table_name
    ,OBJECTPROPERTY( id, 'ExecIsUpdateTrigger') AS isupdate
    ,OBJECTPROPERTY( id, 'ExecIsDeleteTrigger') AS isdelete
    ,OBJECTPROPERTY( id, 'ExecIsInsertTrigger') AS isinsert
    ,OBJECTPROPERTY( id, 'ExecIsAfterTrigger') AS isafter
    ,OBJECTPROPERTY( id, 'ExecIsInsteadOfTrigger') AS isinsteadof
    ,OBJECTPROPERTY(id, 'ExecIsTriggerDisabled') AS [disabled]
FROM sysobjects

INNER JOIN sysusers
    ON sysobjects.uid = sysusers.uid

INNER JOIN sys.tables t
    ON sysobjects.parent_obj = t.object_id

INNER JOIN sys.schemas s
    ON t.schema_id = s.schema_id

WHERE sysobjects.type = 'TR'

Wednesday, September 5, 2012

HOW TO CONVERT FIRST LETTER OF EACH WORD TO UPPER CASE USING C#


 public string UPPERCASE_FIRSTCHAR(string source)
        {
            string result = "";
            try
            {
                result = source;
                if (!string.IsNullOrEmpty(source))                  
                source=System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(source.ToLower());
            }
            catch (Exception ex)
            {
               throw ex;
            }
            return source;
        }