Following query lists all dependent object names and their type that are dependent on object [OBJECTNAME]
SELECT DISTINCT name, so.type
FROM sys.objects AS so
INNER JOIN sys.sql_expression_dependencies AS sed
ON so.object_id = sed.referencing_id
WHERE sed.referenced_id = OBJECT_ID('[OBJECTNAME]');
Where type can be one of the object types below:
C = CHECK constraint
D = Default or DEFAULT constraint
F = FOREIGN KEY constraint
L = Log
FN = Scalar function
IF = Inlined table-function
P = Stored procedure
PK = PRIMARY KEY constraint (type is K)
RF = Replication filter stored procedure
S = System table
TF = Table function
TR = Trigger
U = User table
UQ = UNIQUE constraint (type is K)
V = View
X = Extended stored procedure
Saturday, February 28, 2009
Sunday, November 30, 2008
Change Logical Filenames
Change logical filenames of MS SQL databse
USE MASTER
GO
ALTER DATABASE [DatabaseName]
MODIFY FILE
(NAME = [OldFileName_Data], NEWNAME='NewFileName_Data')
GO
ALTER DATABASE [DatabaseName]
MODIFY FILE
(NAME = OldFileName_Log, NEWNAME=''NewFileName_Log')
GO
USE MASTER
GO
ALTER DATABASE [DatabaseName]
MODIFY FILE
(NAME = [OldFileName_Data], NEWNAME='NewFileName_Data')
GO
ALTER DATABASE [DatabaseName]
MODIFY FILE
(NAME = OldFileName_Log, NEWNAME=''NewFileName_Log')
GO
Monday, August 4, 2008
ObjectDataSource could not find a non-generic method
I got this error"ObjectDataSource could not find a non-generic method" when trying to update or delete a record from GridView that uses ObjectDataSourse whose data source is configured to a tableadapter of a dataset.
I fixed this by specifying parameter "DataKeyNames" in a gridView control and changing OldValuesParameterFormatString="original_{0}" to OldValuesParameterFormatString="{0}" parameter of ObjectDataSource.
I fixed this by specifying parameter "DataKeyNames" in a gridView control and changing OldValuesParameterFormatString="original_{0}" to OldValuesParameterFormatString="{0}" parameter of ObjectDataSource.
Thursday, July 24, 2008
Search for a keyword in stored procedures
Use either of the commands below to list all stored procedures that contain the given keyword.
SELECT ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%keyword%'
AND ROUTINE_TYPE='PROCEDURE'
SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%keyword%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)
SELECT ROUTINE_NAME
FROM INFORMATION_SCHEMA.ROUTINES
WHERE ROUTINE_DEFINITION LIKE '%keyword%'
AND ROUTINE_TYPE='PROCEDURE'
SELECT OBJECT_NAME(id)
FROM syscomments
WHERE [text] LIKE '%keyword%'
AND OBJECTPROPERTY(id, 'IsProcedure') = 1
GROUP BY OBJECT_NAME(id)
Sunday, June 15, 2008
Reset Identity Column Value
DBCC CHECKIDENT statement can reset/reseed the identity column value.
e.g to set the current identity value in "MyTable" to 500 statement will be
DBCC CHECKIDENT (MyTable, RESEED, 500)
Following command can also be used to reset the identity column value if all the records in table can be deleted.
TRUNCATE TABLE MyTable
e.g to set the current identity value in "MyTable" to 500 statement will be
DBCC CHECKIDENT (MyTable, RESEED, 500)
Following command can also be used to reset the identity column value if all the records in table can be deleted.
TRUNCATE TABLE MyTable
Thursday, April 3, 2008
Set Up Email in Outlook 2000
1. Go to Tools Accounts
2. Click on Add Mail
3. In Display Name, type your name. Click "Next"
4. Enter E-mail address
5. My incoming mail server is a "POP3".
6. Incoming Mail (POP3 or IMAP) server: mail.yourdomain.com ; Outgoing Mail (SMTP) server: mail.yourdomain.com
7. Click "Next"
8. Enter account name and password; Click "Next".
9. Finish the wizard keeping rest of the settings to default value
2. Click on Add Mail
3. In Display Name, type your name. Click "Next"
4. Enter E-mail address
5. My incoming mail server is a "POP3".
6. Incoming Mail (POP3 or IMAP) server: mail.yourdomain.com ; Outgoing Mail (SMTP) server: mail.yourdomain.com
7. Click "Next"
8. Enter account name and password; Click "Next".
9. Finish the wizard keeping rest of the settings to default value
Tuesday, March 18, 2008
Can not save hosts file in Windows Vista
When you try to save Hosts or lmhosts file in Microsoft Windows Vista you get access denied error.
Work arround to this issue is specifically opening notepad as administrator even if you have logged in to computer with administrative privilages.
Work arround to this issue is specifically opening notepad as administrator even if you have logged in to computer with administrative privilages.
- Click Start -> All Programs -> Accessories -> right-click Notepad, and then click Run as administrator -> Enter administrator password if requested
- Open the Hosts file or the Lmhosts file -> make the necessary changes -> Save
Subscribe to:
Posts (Atom)