Blocks within Try catch Block
I am pretty sure i know the answer to this but before giving up on using Try Catch I would like verification.The MSDN article on Try Catch states:A TRY…CATCH construct cannot span multiple batches. A...
View Articlehow to post XML to URL?
Hi, I am trying to post a string (xml) to an url EXEC @nval = sp_OAMethod @bj, 'send', NULL, @myString where I have declared @mystring as declare @mystring varchar(8000) and I am trying to create...
View ArticleGroup by calculated field
Hi everyoneI need help. Can anyone suggest me how to do group by on calculated column.In the output now I see service,call two columns, I need to group by service. can you please suggest. Below is the...
View ArticleQuery to HTML
Issue: 300 to 399 Day In NJ section of the code an extra <td> is inserted in the warehouse cellThe section of code is bolded and underlined the corresponds with that tableOutPut Email:Hot List...
View ArticleFrom text date to text date
Hi guys, how can I get from April 2012 to 201201 ?april2012 is an nvarchar(max)...Don't mention it...is not my database.Thanks
View ArticleHow to get Host name and SQL Instance Name by T-SQL
I am using SQL 2000, 2005 and 2008. I have few multi instances SQL servers. I would like to gather following information:Host NameSQL Instance NameSQL VersionServer1Server1SQL 2000Server1Server1\ABCSQL...
View Article"Where Exists" clause is bringing my operation to a crawl -- Is there a...
I have to query a large dataset (2m-3m records), and I have to iterate this query several times for different @Date Parameters. The query resides in a stored procedure which I run from a C# app. They...
View ArticleAdding three hours to a time stamp.
Hi All, We have a table with columns like |First_Occurance |Second_Occurance | |Jan 6 2014 11:06AM|Jan 6 2014 11:30AM | We need to add three hours to each row in First_Occurance column in a table to...
View ArticleHow to Recursively Sum a Sum?
Sorry, everyone, this is driving me nuts. I have the following query, which gives me the relative percentage of [INDEX MARKET CAP].SELECT *, [INDEX MARKET CAP] * 100/SUM([INDEX MARKET CAP]) OVER() as...
View ArticleHow to select items that are not selected yet?
Greetings community,Another newbie's question I have to ask.It’s part of more complicated problem but for simplicity let’s say that I have two tables:Table Items:ItemID...
View ArticleHelp with Over
Greetings everyone,I'm trying to use the over function but with two sums, the point is to get the points of a sum to make a graphic that goes up and down depending on this values.This is the first part...
View ArticleDeadLock on Same Wait resource
<deadlock><victim-list><victimProcess id="process10258508" /></victim-list><process-list><process id="process10258508" taskpriority="0" logused="912"...
View ArticleDynamic SQL in table vauled function or CLR
So I have a query that gives me some analysis on the values in a column, in a table. It reurns a small data set.It gives me the max, min, stdev, avg and some other stats grouped by another column.I...
View Articlehow to retrieve Min(startDate) and Max(endDate) for different groups of data?...
My sample dataset (below) contains 3 groups -- 'a', 'b', 'c'. I need to retrieve the Min(startDate) and Max(EndDate) for each group so that the output looks something like this (date format not an...
View ArticlePackage Logging error information
I want to log any error occurs in the package to a log table before exiting the execution.Steps I performed.1. Created a simple table LogTab say with 2 columns col1 to capture the error codecol2 to...
View ArticleTime datatype issue from SSIS
Hi All,I have a SSIS pkg, I have1. Sart_time (datetime datatype)2. End_time (datetime datatype)3. Run_time ( Time(0) datatype)I am using the Run_time to get the difference of star & end time to...
View ArticleImprove the performance in a select statement
Hello all, I hope you can help me. I don't have a good performance in my select statement (I use two selects) and I'd like to do a 'merge' between them but I'm not sure how I could do it (or maybe I...
View ArticleExecuting multiple queries stored in multiple rows
Hi, I have a question. I have a table that contains import scripts for my database. Below is the set up IDTable DateScript 1TableA NULLINSERT INTO [dbo].[TableA] SELECT * FROM OPENROWSET...
View ArticleEmailbody using SQL: Align Table with Headers
I have a requirement, Where I need to align header and table contents , as a part EMAIL body in HTML format. I'm getting the resultset from a table. Here is the output Rows in these Columns have...
View ArticleStored Proc to update Table multiple ways
I've a Table1, like belowIDGroup1G12G2I've a Table2, like belowIDItem1T12T2If I Run my Stored Procedure, I need to generateTable3 like belowIDGroupItem1G1T12G1T23G2T14G2T2If I add G3 to theTable1&...
View Article