Viewing 15 posts - 1,831 through 1,845 (of 5,504 total)
The issue is the
CONVERT(VARCHAR,DATEADD(DAY,2, @fec),112),
part of your GROUP BY statement.
Since there is no column reference, it'll throw the error you see.
You should get the expected result set result by either...
March 2, 2011 at 12:05 pm
Craig Farrell (3/2/2011)
By Jove! You've forgotten about taking care of your SOX while you're at it! In dealing with a rainforest, you'll catch some nasty things...
March 2, 2011 at 11:19 am
Mark Derryberry (3/1/2011)
March 1, 2011 at 3:47 pm
badamaams (3/1/2011)
Hi LutzThe solution worked brilliantly. Many thanks.
Could you please explain the RelationshipTable.MASTERID>RelationshipTable.RELATEDID and the RelationshipTable.MASTERID<RelationshipTable.RELATEDID
once again, many thanks
Glad I could help 😀
I used the MASTERID/RELATEDID comparison as shown above...
March 1, 2011 at 12:09 pm
I'd start with listing the installations/DB's I'm aware of and try to identify the data owner.
Then I'd try to categorize the DB's: owner, type of usage (maintenance, dev, prod, reporting,...
February 28, 2011 at 3:38 pm
I added a check for MASTERID>RELATEDID rsp. MASTERID<RELATEDID.
Since this returned duplicate values, I also had to change UNION ALL to UNION.
WITH
related_CTE
(RelationshipTableID,
MASTERID,
RELATEDID,
RELATIONSHIP) AS
(
SELECT RelationshipTableID, MasterID, RelatedID, Relationship
FROM RelationshipTable
WHERE (RelationshipTable.MasterID = 502)...
February 28, 2011 at 2:53 pm
Sorry for missing the requirement to search the family tree up and down for various members somewhere in the middle of the structure. 😉
There might be easier solutions available but...
February 28, 2011 at 2:16 pm
The issue is caused by your table design:
Since the same information is inserted twice you're forcing a referential loop.
Example:
insert into RelationshipTable (MasterID,RelatedID,Relationship) values (200,201,'Parent')
insert into RelationshipTable (MasterID,RelatedID,Relationship) values (201,200,'Child')
insert into...
February 28, 2011 at 1:53 pm
jvElecenter (2/28/2011)
HiI should have all remarks.
How to build up ?
Kind regards
Each of the options I posted in my previous post will meet that requirement.
Maybe you should show us some sample...
February 28, 2011 at 10:46 am
daveriya (2/27/2011)
this is not a my hw,and this forum is about to help each other,i m learning so many things.and i am learning through this blog
Please clarify the contradiction between...
February 27, 2011 at 1:17 pm
Please post table def and sample data in a ready to use format as described in the first link in my signature. Also, please include your expected result basd on...
February 27, 2011 at 2:39 am
daveriya,
this is the 3rd or 4th post regarding your homework / school project.
Did you ever consider the option that those questions are there to verify what you've learned instead of...
February 26, 2011 at 2:50 pm
Another part of your homework assignment?
Since SQL doesn't have arrays, this section most probably is about a frontend dev.
In case your tutor is teaching you that arrays are part of...
February 26, 2011 at 2:21 pm
Something like this?
SELECT 123 * 1000 + number + 1
FROM master..spt_values
WHERE TYPE='P' AND number < 999
February 26, 2011 at 2:38 am
Yes, it's possible:
Option 1:
Find the logic that will cause an error and exclude those rows before you perform the insert.
Option 2:
Since it's a staging table, you could remove the...
February 26, 2011 at 2:35 am
Viewing 15 posts - 1,831 through 1,845 (of 5,504 total)