Ads

25 July 2013

Running Batch File Using T-SQL

DECLARE @PassedVariable VARCHAR(100)
DECLARE @CMDSQL VARCHAR(1000)
SET @PassedVariable = 'SqlAuthority.com'
SET @CMDSQL = 'c:findword.bat' + @PassedVariable
EXEC master..xp_CMDShell @CMDSQL




more on :- http://blog.sqlauthority.com/2007/06/27/sql-server-running-batch-file-using-t-sql-xp_cmdshell-bat-file/
 

16 July 2013

Replication - Between 2005 and 2008

Using a SQL Server 2005 or SQL Server 2008 Distributor with a Publisher Running SQL Server 2000

SQL Server 2005 and SQL Server 2008 can be used as a remote Distributor for Publishers that are running SQL Server 2000. To change agent properties in this scenario, execute the following stored procedures at the Distributor. These procedures let you change properties that were introduced in SQL Server 2005:
If you have a Publisher and Distributor that are running SQL Server 2000, you can change the credentials under which agents make connections by using sp_changedistpublisher and sp_changesubscriber. However, if you upgrade the Distributor to SQL Server 2008, these procedures cannot be used to change the credentials that are used in existing agent jobs. The procedures do affect agent jobs that are created after the procedure is called. To change the credentials for existing agent jobs, call one of the four procedures listed previously.

IMP :-

SQL Server 2000 and SQL Server 2005 can both participate in replication topologies with SQL Server 2008. For SQL Server 2000 the minimum version is Service Pack 3 (SP3). For SQL Server 2005 the minimum version is Service Pack 2 (SP2).
When you replicate between or among different versions of SQL Server, you are usually limited to the functionality of the earliest version used. For example, if you upgrade a Distributor to an instance of SQL Server 2008, but you have a Publisher that is running an instance of SQL Server 2005 and a Subscriber that is running an instance of SQL Server 2000, you are limited to the general functionality and replication functionality of SQL Server 2000.
NoteNote
Because the SQL Server on-disk storage format is the same in the 64-bit and 32-bit environments, a replication topology can combine server instances that run in a 32-bit environment and server instances that run in a 64-bit environment.
For all types of replication, the Distributor version must be no earlier than the Publisher version. (Frequently, the Distributor is the same instance as the Publisher.)
For transactional replication, a Subscriber to a transactional publication can be any version within two versions of the Publisher version. For example, a SQL Server 2000 Publisher can have SQL Server 2008 Subscribers, and a SQL Server 2008 Publisher can have SQL Server 2000 Subscribers.
For merge replication, a Subscriber to a merge publication can be any version no later than the Publisher version. For more information about compatibility for earlier versions, see "Compatibility Level for Merge Publications" later in this topic. For more information about replication features that are supported in the various editions of SQL Server, see Features Supported by the Editions of SQL Server "Denali".

04 July 2013

.TUF file

TUF file is a Microsoft SQL Server Transaction Undo file. .TUF File contains the information regarding any modifications that were made as part of incomplete transactions at the time the backup was performed.

A transaction undo(.TUF) file is required if a database is loaded in read-only state. In this state, further transaction log backups may be applied.

if  .TUF file is deleted then log shipping restoration job will not work.


01 July 2013

OLE DB error: OLE DB or ODBC error: You do not have permission to run 'SP_TRACE_CREATE'.; 42000

OLE DB error: OLE DB or ODBC error: You do not have permission to run 'SP_TRACE_CREATE'.; 42000

 

Answer:- 

 

USE master
GO
GRANT ALTER TRACE TO [LOGINNAME]
GO

16 May 2013

Health Tip- Easy Way To Burn Calories

For anyone trying to lose weight, this question is an exciting one! If you simply want to know if your body burns calories warming up the water, the answer is yes. But if you want to know if drinking a lot of ice water can help you lose weight, or keep weight off, this "yes" needs to be qualified with some calculations.
First of all, calories are case-sensitive. There are calories and then there are Calories. Calories with a big "c" are the ones used to describe the amount of energy contained in foods. A calorie with a little "c" is defined as the amount of energy it takes to raise the temperature of 1 gram of water 1 degree Celsius.
What most people think of as a Calorie is actually a kilo-calorie: It takes one Calorie to raise the temperature of 1 kilogram of water 1 degree Celsius. So when you drink a 140-Calorie can of cola, you are ingesting 140,000 calories. There is no cause for alarm, because the conversion applies across the board. When you burn 100 Calories jogging a mile, you are burning 100,000 calories.
So, considering that the definition of a calorie is based on raising the temperature of water, it is safe to say that your body burns calories when it has to raise the temperature of ice water to your body temperature. And unless your urine is coming out ice cold, your body must be raising the temperature of the water. So calories are being burned.
Let's figure out exactly what you're burning when you drink a 16-ounce (0.5 liter) glass of ice water:
  • The temperature of ice water can be estimated at zero degrees Celsius.
  • Body temperature can be estimated at 37 degrees Celsius.
  • It takes 1 calorie to raise 1 gram of water 1 degree Celsius.
  • There are 473.18 grams in 16 fluid ounces of water.
So in the case of a 16-ounce glass of ice water, your body must raise the temperature of 473.18 grams of water from zero to 37 degrees C. In doing so, your body burns 17,508 calories. But that's calories with a little "c." Your body only burns 17.5 Calories, and in the grand scheme of a 2,000-Calorie diet, that 17.5 isn't very significant.
But let's say you adhere to the "eight 8-ounce glasses of water a day" nutritional recommendation. In 64 ounces of water, there are 1,892.72 grams. So to warm up all that water in the course of a day, your body burns 70,030 calories, or 70 Calories. And over time, that 70 Calories a day adds up. So, while you definitely shouldn't depend on ice water consumption to replace exercise or a healthy diet, drinking cold water instead of warm water does, in fact, burn some extra Calories!


http://health.howstuffworks.com/wellness/diet-fitness/weight-loss/question447.htm

08 May 2013

ALTER PARTITION SCHEME




ALTER PARTITION SCHEME NEXT USED ALTER PARTITION FUNCTION SPLIT RANGE ('100') Go


Example:-


ALTER PARTITION SCHEME cover NEXT USED [SSD] ALTER PARTITION FUNCTION covern() SPLIT RANGE ('201') Go

ALTER PARTITION SCHEME cover  NEXT USED [SSD] ALTER PARTITION FUNCTION covern() SPLIT RANGE ('202') Go

ALTER PARTITION SCHEME cover NEXT USED [SSD] ALTER PARTITION FUNCTION covern() SPLIT RANGE ('203') Go