Viewing 15 posts - 16 through 30 (of 34 total)
As a work-around and I hope this helps but the key here is you must dump the result sets into a temp tables. In the stored procedure I usually use...
June 22, 2012 at 9:13 am
Look up composable DML on this site/google. Something like this should work but would be a major help if we had sample data.
INSERT @NewPolicyEventRiskUnits
SELECT PolicyEventTrID,StagingPolicyRiskUnitTrID,PolicyRiskUnitTrID
FROM( MERGE Policy.PolicyRiskUnit AS Target
...
June 20, 2012 at 8:32 am
We have a indexed table in our database called Tally but on the fly I usually just cross join the sys.all_columns tables multiple times. My solution is below.
DECLARE @INT BIGINT...
June 4, 2012 at 11:05 am
Great point guys. Here is a better solution with dynamic sql.
IF OBJECT_ID('tempdb..#basetable') IS NOT NULL
DROP TABLE #basetable
CREATE TABLE #basetable
(
caseid INT,
formname VARCHAR(255),
name VARCHAR(255),
value VARCHAR(255)
)
DECLARE @sql VARCHAR(MAX)
DECLARE @cols VARCHAR(MAX)
DECLARE @joins...
June 4, 2012 at 8:13 am
June 1, 2012 at 10:56 am
Nevermind...my solution was wrong 🙁
May 31, 2012 at 1:06 pm
I was bored but this should work:
IF OBJECT_ID('tempdb..#basetable') IS NOT NULL
DROP TABLE #basetable
CREATE TABLE #basetable
(
caseid INT,
formname VARCHAR(255),
name VARCHAR(255),
value VARCHAR(255)
)
DECLARE @sql VARCHAR(MAX)
DECLARE @cols VARCHAR(MAX)
DECLARE @joins VARCHAR(MAX)
INSERT #basetable(caseid,formname,name,value)
VALUES
(1, 'Highways', 'roadname',...
May 31, 2012 at 10:23 am
It is probably coming from the TVF dbo.fn_get_attrib_guid_from_xml. Have you stepped through this because I believe the rest of your code looks fine?
May 16, 2012 at 1:18 pm
This is getting good.
I understand both sides of this argument. Now sure if there is an correct answer. 😉
May 16, 2012 at 1:00 pm
I think you may end up with some type of union no matter what but here is my solution...Change DENSE_RANK to RANK if you need to.
DECLARE @PRODUCTS TABLE (
Product_id int
,ProductName...
May 9, 2012 at 8:54 am
Here is my final attempt...You probably want to re-check your test data and desired results to see if everything is sync'd properly.
;WITH CTE
AS (
SELECT
c1.Case_ID,
c1.Legal_Omn,
c1.PPL_Area,
Review_Status =
CASE
WHEN c1.Review_Status NOT IN...
April 19, 2012 at 9:51 pm
Based on the explanation,testdata and your desired results...why would WA_TENANT be in the column for 30-60 days for "Active"? Look at your test data:
UNION ALL SELECT 220, 'Civil', 'WA_Tenant', 5,...
April 19, 2012 at 8:51 pm
After reading this thread I'm not even close to being clear as to what you want but here is my interpretation. If there duplicate review statuses for a ppl_area(tenant)...I choose...
April 19, 2012 at 6:52 pm
Below is code using Grouping Sets SSRS 2008...1 table scan
DECLARE @Case_Review TABLE
(Case_ID int, Legal_Omn varchar(30),PPL_Area varchar(30),Revision int
,Review_Status varchar(30),Change_Date datetime);
insert into @Case_Review
SELECT 220, 'Civil', 'WA_Tenant', 1, 'Proposed', '2012-04-17 12:17'
UNION ALL SELECT...
April 19, 2012 at 2:54 pm
Sorry, corrected the original post. DMV = Dynamic Management View
March 13, 2012 at 1:12 pm
Viewing 15 posts - 16 through 30 (of 34 total)