|
Msg 14650, Level 16, State 1, Procedure sp_send_dbmail, Line 68 |
|
Msg 14650, Level 16, State 1, Procedure sp_send_dbmail, Line 68
Service Broker message delivery is not enabled in this database.
Use the ALTER DATABASE statement to enable Service Broker message delivery
|
 |
|
Comments (0)
|
More...
|
|
|
By Aleksandar Tosic on
Thursday, October 23, 2008
|
|
|
|
|
|
|
How to generate a random number in SQL Server |
|
To genereate a random number in SQL Server we can use random function. Check example below where a random generated number is between 1 and 100:
select rand()
select rand() * 100
select cast(rand() * 100 as int) as number
|
 |
|
Comments (0)
|
|
|
T-SQL
|
By Alex on
Wednesday, October 15, 2008
|
|
|
|
|
|
|
Msg 7411 - Server "ServerName" is not configured for DATA ACCESS. |
|
To alow darta access through linked server using OPENQUERY we need to set set linked server "DATA ACCESS" option to true:
EXEC sp_serveroption 'YourServer', 'DATA ACCESS', TRUE
Use this option when you get following error message:
Msg 7411, Level 16, State 1, Line 1
Server 'MYSERVER' is not configured for DATA ACCESS.
|
 |
|
Comments (1)
|
|
|
Configuration
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
MSQL_XP - wait type on sys.dm_os_wait_stats |
|
MSQL_XP is the wait type that occurs when a task is executing an extended stored procedure - XP. SQL Server does not have control over an XP even though it is executing within the SQL Server process. Investigation of these waits requires investigating the execution of the extended stored procedure code—the vendor may have provided diagnostic tools for the < ...
|
 |
|
Comments (0)
|
More...
|
|
Blocking
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
How to empty a database file - Emptying a file |
|
Emptying a file
The following example demonstrates the procedure for emptying a file so that it can be removed from the database. For the purposes of this example, a data file is first created and it is assumed that the file contains data.
http://msdn2.microsoft.com/en-us/library/ms189493.aspx
USE AdventureWorks;
GO
-- Create a data file and assume it contains data.
ALTER DATABASE AdventureWorks
ADD FILE (
NAME = Test1data,
FILENAME = 'C:\t1data.ndf',
SIZE = 5MB
);
GO
-- Empty the data file.
DBCC SHRINKFILE ('Test1data', EMPTYFILE);
GO ...
|
 |
|
Comments (0)
|
More...
|
|
Database Files
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
|
Using Blocked Process Report event class in SQL Server Profiler 2005. |
|
sp_configure 'show advanced options', 1 ;
GO
RECONFIGURE ;
GO
sp_configure 'blocked process threshold', 10 ;
GO
RECONFIGURE ;
GO
Create a new trace in Profiler and select the "Blocked Process Report" event listeds under the "Errors and Warnings" event category.
After this setup, you should see all blockings taking longer than 10 seconds using this trace.
|
 |
|
Comments (0)
|
|
|
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
|
|
@@IDENTITY and SCOPE_IDENTITY() |
@@IDENTITY and SCOPE_IDENTITY() will return the last inserted identity value in the current session but in different scenarios they can each return different values.
While both @@IDENTITY and SCOPE_IDENTITY return the last identity value generated in any table in the current session, SCOPE_IDENTITY() will return the value only within the current scope (a scope is a stored procedure, trigger, function, or batch) while @@IDENTITY is not limited to a specific scope.
|
|
Comments (0)
|
More...
|
|
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
|
|
|
DBCC LOGINFO ('DATABASENAME') |
Use an undocumented DBCC command DBCC LOGINFO to to see if VLF's contain active transactions.
DBCC LOGINFO('DATABASENAME')
Click below for more details:
|
 |
|
Comments (0)
|
|
|
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
|
|
|
|
|
Online Index Operations - SQL Server 2005 |
|
The online index feature provides a powerful way to perform maintenance operations such as rebuilding or creating indexes in a production system without sacrificing DML concurrency.
This feature allows concurrent modifications (updates, deletes, and inserts) to the underlying table or clustered index data and any associated indexes during index data definition language (DDL) execution. For example, while a clustered index is being rebuilt, you can continue to make updates to the underlying data and perform queries against the data.
|
 |
|
Comments (0)
|
More...
|
|
Performance
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
SQL Server 2005 Catalog view |
|
In SQL Server 2005, the system tables are gone. The system tables from previous versions of SQL Server are now implemented as a series of views called catalogue views and all of these catalogue views can be found in the sys schema.
select * from sys.all_views
|
 |
|
Comments (0)
|
More...
|
|
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
Selecting random pages using tabid in DotNetNuke based on tabname similarity |
|
declare @tabid int
declare @tabname nvarchar(100)
set @tabid = 7
--select * from tabs where tabid = @tabid
select @tabname = tabname from tabs where tabid = @tabid
--select * from tabs where IsVisible = 1 and ParentID is null
select top 10 DIFFERENCE(@tabname,tabname),@tabname,tabname from tabs where IsVisible = 1 and ParentID is null order by DIFFERENCE(@tabname,tabname) desc
This code is used to list similar tabnames (pages) when tabid is provided.
|
 |
|
Comments (0)
|
|
|
|
By Aleksandar Tosic on
Wednesday, October 15, 2008
|
|
|
|
|
|
|
|
Formatting data in Reporting Services 2005 when creting report |
FormatDateTime function i a VBScript function the formats date or time.
Example:
= FormatDateTime(Fields!PublicationDate.Value,2)
Formats
vbGeneralDate 0 Display a date in format mm/dd/yy. If the date parameter is Now(), it will also return the time, after the date
vbLongDate 1 Display a date using the long date format: weekday, month day, year
vbShortDate 2 Display a date using the short date format: like the default (mm/dd/yy)
vbLongTime 3 Display a time using the time format: hh:mm:ss PM/AM
v ...
|
 |
|
Comments (0)
|
More...
|
|
Reporting Services 2005
|
By Alex on
Wednesday, October 15, 2008
|
|
|
|