|
*************************** Get User Permission **************************
sp_helprotect TableName
or
sp_helprotect storeprocName
ex:
sp_helprotect comms_txn_incoming -- Table Name
sp_helprotect bene_failed_delivery -- StoreProc Name
**************************** Get Table Size ****************************
SP_SPACEUSED 'Table Name'
Ex ::
SP_SPACEUSED 'sysobjects'
Output ::
name rows reserved data index_size unused
---------- ----- ---------- ----- -------- ----------
sysobjects 1546 584 KB 200 KB 240 KB 144 KB
************************** Primary & Foreign Key ************************
sp_pkeys 'comms_txn_incoming'
sp_fkeys 'comms_txn_incoming'
*************************************************************************
modified on Tuesday, November 18, 2008 6:57 AM
|
|
|
|
|
select sysObj.name , sysIndex.rowcnt from sysobjects as sysObj
inner join sysindexes as sysIndex on sysObj.id = sysIndex.id
where sysObj.xtype = 'u'
|
|
|
|
|
SELECT object_name(sc.id) FROM SYSCOMMENTS sc WITH (NOLOCK)
WHERE sc.text LIKE '%Search_Content%'
and sc.id > 0
ORDER BY object_name(sc.id)
// For purging ::
DBCC SQLPERF(LOGSPACE)
modified on Friday, March 20, 2009 7:58 AM
|
|
|
|
|
// Please include #include "Windows.h" -- HANDLE defination
// Please include #include "Winbase.h"
// Please include #include "TCHAR.h" --
HANDLE hEventSource;
/* Get a handle to use with ReportEvent(). */
// TCHAR chMsg[1000];
// LPTSTR lpszStrings[1];
LPCTSTR lpstr = "Testing going on.";
hEventSource = RegisterEventSource(NULL,_T("test"));
if (hEventSource != NULL)
{
/* Write to event log. */
// EventID is very important we need to create DLL for the same
// DLL will be created and will be registered to eventlog
// NumberofParameter will specify what should be input lpstr will be LPCTSTR array if NumberofParameter paramter is more then 1.
ReportEvent(hEventSource, EVENTLOG_INFORMATION_TYPE, 0,0 , NULL, 1, 0, &lpstr, NULL);
// ReportEvent(hEventSource, EVENTLOG_INFORMATION_TYPE, category ,EventID , NULL, NumberofParameter , 0, &lpstr, NULL);
DeregisterEventSource(hEventSource);
}
----------------------------------------------------------------------------------
Note :: for proper eventlog we requried DLL to be registered on Eventlog path
// "HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\EventLog\\Application\\ApplicationName"
// copy to file xxx.mc
;//**********************Category Definitions***********************
MessageId=1
Facility=Application
Severity=Success
SymbolicName=CATEGORY1
Language=English
Test Category 1
.
;//********************End of Category Definitions******************
;// MessageIdTypeDef should NOT be altered
;// Event definitions are of type DWORD
MessageIdTypedef=DWORD
;//***********************Event Definitions***************************
MessageId=1001
Facility=Application
Severity=Success
SymbolicName=EVENT_1001
Language=English
Username: %1, Password: %2.
.
;//***********************End of Event Definitions********************
// xxx.mc file completed ---------------------------------------------------------
// compile xxx.mc file C:\Program Files\Microsoft Visual Studio\VC98\Bin\mc.exe
// output of it will be xxx.rc
// include it to resouce file of DLL and build DLL.
----------------------------------------------------------------------------------
// Refer url for any further understanding
_http://www.codeproject.com/KB/system/eventlogging.aspx
modified on Wednesday, March 25, 2009 12:21 PM
|
|
|
|
|
|
----------------------------- ShellExecute -------------------------
For executing any application from Executable in VC
ShellExecute(NULL,NULL, "iexplore.exe","http://www.test.com", NULL, SW_SHOWNORMAL);
------------------------------- Registry -----------------------------
For opening registry RegOpenKey or RegOpenKeyEx functions. If the keys need to be created, the RegCreateKey and RegCreateKeyEx functions do the job. Ex is for 32 bit versions
The RegSetValue and RegSetValueEx functions allow the settings of a value to be modified, while RegQueryValue and RegQueryValueEx retrieve the current setting of a value.
Example ::
RegCreateKeyEx(lPredefinedKey, sNewKeyName, 0&, _ vbNullString, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, _ 0&, hNewKey, lRetVal)
RegOpenKeyEx(HKEY_CURRENT_USER, sKeyName, 0, _ KEY_QUERY_VALUE, hKey)
HKEY hRegKey = NULL;
DWORD regDword;
// creates or opens(if key already exists) the registry key
RegOpenKeyEx(HKEY_LOCAL_MACHINE, MY_LOGGER_REG_PATH, 0, KEY_QUERY_VALUE, &hRegKey) ;
if (hRegKey == NULL)
RegCreateKeyEx(HKEY_LOCAL_MACHINE, MY_LOGGER_REG_PATH, 0, NULL, REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hRegKey, ®Dword);
modified on Wednesday, March 25, 2009 11:05 AM
|
|
|
|