Indiviual Email
Hi ALL ,I have a customer table with columns Name, Email & Date Data example Ron ron@xyz.com 6/19/2014John John@xyz.com 6/19/2014Darren Darren@xyz.com 6/19/2014Now i need to send emails to all...
View Articlehow can i work with getdate() in my query if i have a varchar datatype on...
Hi All,I have a column like lastdate with varchar datatype. now I want to work with lastdate column in where clause with getdate().Ex: wheregetdate() - lastdate < 1when I use above one I got...
View ArticleUPDATE performance
hi all - I have a table called trans with 15 million rows and I need to update various columns in this table; some of the updates require joining this table with other tables and other updates do not...
View ArticleCapture / Analyze Wait Statistics
I was playing around with capturing wait statistics and was looking at trying to put out some output that would subtract previous capture/name record value from next capture/name record given a date...
View ArticleSQL Query Help
I'm working with a Sophos 5.21 database - attempting to build a report that identifies active viruses that have had no action taken. I have 2 tables that I am pulling data from: [Sophos Reporting...
View ArticleIs Shrink DB a Good or a Bad Thing to Do?
I have used Shrink DB quite regularly in the past with a satisfying reduction in file size. I have seen debate recently that this is not necessarily a good thing to do. Is it the case that the unused...
View Articlehow to optimise update query
Hi, If following query, i tried to check the plan i noticed both where same pls suggest as thum of rule what should be followed. thought i will check plans in each cases. 1) update t1 set a, b, c, d...
View ArticleSplit data into groups
Hello, can anyone make a suggestion on how to make this work fasterAny advice would be greatUSE [test] GO CREATE TABLE [dbo].[PeopleX]([P1] [int] NULL,[P2] [int] NULL,[Grup] [int] NULL ) ON [PRIMARY]...
View ArticleGet variable values from a stored procedure
I am using SQL 2008R2 and I want to replace a view inside a stored procedure with a new stored procedure to return multiple variable values. Currently I am using the code below to get values for 4...
View ArticleFormatting person's name
I have a table with a persons firstname, and lastname. And neither one are required fields. I inherited this database so I don't agree with the structure but I have to deal with it..Anyways I need to...
View ArticleLEFT OUTER JOIN where values is empty
I have a table where I am able to sum of the count of calls based on call code... so the result looks something like thisINIT_CALLBRD_ACTION_CDNumber_of_Calls HHFR28 RFAA4When there are no RFAA calls,...
View ArticleMixed Collation
I have different collation in my database then on the server. Every time when i define temp table inside query I also set its collation to database collation - to prevent collate conflicts.But what...
View ArticleDetermine Days Since Last Visit
I think I may be overthinking this problem.What I have is a table that consists of membership data including visit dates. For each visit date, I need to determine the number of days since the last...
View ArticleTSQL to copy backups to a new location
Hello,I am trying to select the most recent backup of a database and move it over to a new location. However I am unable to assign the top1 max to a variable. Here is my script:DECLARE @cmd...
View ArticleOrder by problem.......how to Ascending order by date from the following query
hii have following query to show the monthly sales after summing up monthly sales total but i have facing a problem this query is not properly perform order by clause according to the months like...
View ArticleUsing calculated result from previous row
Hi,I am not sure if this is possible as I haven't found a solution yet online. In short I have a table with some values such as:UniqueRowNo Value 1 52...
View ArticlePossible to prevent sp_send_dbmail from triggering too many emails ?
Hi,One fine day, I accidentally executed a TSQL that had infinite loop and each loop triggered an email using sp_send_dbmail. As a result, 16K emails jammed my email account. I was wondering if there's...
View Articledata conversion and appending
<p>I am working with existing code and am changing the data source for some queries. The original data source had a date field that needs to be compared to another date field. ...
View ArticleCalling all T-SQL users! May TechNet Gurus announced!
The results for May's TechNet Guru competition have been posted!http://blogs.technet.com/b/wikininjas/archive/2014/01/16/technet-guru-awards-december-2013.aspxCongratulations to all our new Gurus for...
View Article