Identify and Stop stored proc from running
SQL 2005 & 2008We have several servers where, using the sp_procoption system stored procedure, we've enabled and started the execution of a user stored procedure. While I'm aware of how to disable...
View ArticleSubstituting Column values as Math function
Hi I have case while working in my stored proc wherein based on the function id ineed toapply suitable mathematical functions on the metric tableEg::for Metric id value"1" the function look up...
View ArticleEmail alert on schema update
Is there an easy way to get an email alert when any database object is updated? Is there some built-in function in SQL Server that can do this?
View Articlerecords in same line with multiple data
Hi , I have two Tables and Script are as follows , CREATE TABLE [dbo].[T_COI_INITIATION]( [INITIATION_ID] [int] NOT NULL, [INVITATION_DATE] [date] NOT NULL, [FREEZING_DATE] [date] NOT NULL,...
View Articlewhat comes first
hiwhen u execute statement likeselect top 1 columne from tablewhere coumtn1 = 1000group by column2 having count(colume)>1 order by column 3internally how sql server execute itwhich comes first...
View ArticleNeed a faster way to handle a massive IN clause
I have a query that has a dynamically created ID list for an IN clause that may contain up to 100,000 IDs. Is there a trick that I can do to reduce the run time on the query. (Function, Stored...
View ArticlePermanent enable auto select feature in SQL server 2008
Is there a way to make the auto select feature permanent in SQL Server 2008?I know about ctrl+alt+space command but it only enables auto-select feature for the particular query I am working on.
View Articleabout dates subtraction from other table
i have a table t1 which contains from date and to date and had an other table t2 which contains particular dates, now i want to check t2 dates are in between the t1 table for each record if there are...
View ArticleHow to Convert the DateTime Value into the Fiscal Year ???????
I have a table weekendsummary , In this there is a field "MeetingDate" .I want to write a T-SQl Code which gives me the Fiscal Year On the Basis of MeetingDatei.e. if Meeting Date is --"2013-04-26...
View ArticleReserve Identity column values
Hi, I am using SQL Server 2008 R2. I was wondering if reserving values for an Identity Column could be done. For instance I have a Column ColA with IDENTITY(1,1) and would like to reserve values 101 -...
View ArticleHow can we change the default length of DateTime field in SQL Server
Hi,I have created a datetime field in a table in SQL Server as created_date DATETIMEBy default SQLServer sets the maximum length of this field to 23 i.e. precision of this column is 23 when I executed...
View ArticleSSRS 2005 Hourly Subscrption working only 24 hrs?
i have configured the hourly subscrption. It's working only one day. After 24 hrs the hourly subscrption is not working.Example: Today i configured the subscrption at 10 AM. This subscrption working...
View Articleopening & closing stock
i am using sql server 2008my table is CREATE TABLE [dbo].[tbl_enventry]([TransactionDate] [smalldatetime] NULL,[Item] [char](1) NULL,[RecQty] [int] NULL,[IssueQty] [int] NULL (i have written query...
View ArticleSet database offline/online remotely SQL 2005
Hi,One of our cluster Server got disk issue and msdb database goes offline/unavailable on that sql server.I have to manually take database offline and then online using t-sqlI was thinking if i can run...
View Articleidentity on case sensitive varchar field
hello,i need to make my already case senstivite varchar(6) field the identity for my table.I want that instead of autoincrement it generates new keys, it can use numbers and both lower/upper case...
View ArticleRestore from FULL Backup and restore all TLOG backups after Full Backup
I have 1 standby server where I do copy Full Backup nightly (takes 9-10 hours to copy backup file and 100GB backup file with compression) and another copy job to copy Tlog files to the same standby...
View ArticleSET Quoted Identifier Error When SQL Agent Job Runs vs. In SSMS
I have a job to create indexes on a custom warehouse made by a third party. Some of these indexes are filtered. The job ran fine until a couple of nights ago when I started getting, " CREATE INDEX...
View ArticleHow to generate a xml doc using from database using T-sql
Hello all,I have an xml file stored in my database as shown below:Above screenshot is for exampleI want to write a t-sql which use this data and create and xml file which is saved in this column.So at...
View ArticlePartitioned views : how to filter on the partition key in a stored procedure ?
I am using partitioned views in SQL Server 2008 R2. When I create a query filtering on the partition key (customerID), I get partition elimination as expected. But when I use a variable to filter on...
View Article