Viewing 15 posts - 1,411 through 1,425 (of 1,920 total)
Dan, as John mentioned, if you are using a WHILE Loop or CURSOR to iterate through your tables, and assuming your table is a heavy-set, then it is absoultely unavoidable...
June 3, 2010 at 10:41 am
Assume all your 3 tables has only one column.
Values in Table RequestForServices:
A1
A2
A3
A4
Values in Table ReferralSourceTypes:
B1
B2
B3
Values in Table SourceOfReferral
A1
A2
So your following query :
SELECT ClientNumber,CaseNumber,ReferralSourceTypes.ReferralSourceType,ReferralSourceTypes.ReferralSourceDesc FROM
RequestForServices,ReferralSourceTypes
will produce a Cartesian Product ...
June 3, 2010 at 10:36 am
Sachin, remove the "( )" from your code ;
Sample code:
create table #temp1
(
a int
)
select * From #temp1
alter table #temp1 add b int , c int ;
select * from #temp1
June 2, 2010 at 10:59 pm
Tim, will your string have only two facility IDs and 2 patient IDs always? Will the format of the string change from row to row..
Please post us sample data...
June 2, 2010 at 8:34 pm
I sense the OP needs 4 columns out of the string, as in, FirstFacilityID ,FirstPatieintID, SecondFacilityID, SecondPatieintID ; these 4 columns will hold only intergers, stripped from the real string..
June 2, 2010 at 8:29 pm
To illustrate what Gail had said , here is a small sample code that will auto-increment a column using IDENTITY column; execute the code in your SQL Express ; follow...
June 2, 2010 at 2:39 am
Goodness me, i lost track of this thread and now i saw that this alpha-numbering is a huge swear-word dump-yard.. hmmm,as u said Jeff, it will invite lawsuits.. lets wait...
June 1, 2010 at 10:26 am
sachinrshetty (6/1/2010)
Thank u coldcoffee. I will try with your first logic as it seems to be simple and smaller.With Regards
sachin
More than simple and small, that code is highly-efficient for large...
June 1, 2010 at 3:05 am
hi there, here is one piece that might interest you! This is **NOT** the optimal solution for the problem, but for now, you can have this. The desired output can...
June 1, 2010 at 3:01 am
If you cannot create a Tally table, you can make of this code to create a CTE for Tally Table and then use the real code to generate the desird...
June 1, 2010 at 2:26 am
Sachin, this might help you:
DECLARE @DATE DATETIME
SET @DATE = '01-01-1985'
SELECT DATEPART(YY,DATEADD(M,N-1,@DATE)) [YEAR], DATENAME(MM,DATEADD(M,N-1,@DATE)) [MONTH]
FROM Tally
WHERE DATEPART(YY,DATEADD(M,N-1,@DATE)) <= YEAR(GETDATE())
To know how to create Tally table, refer the following link from...
June 1, 2010 at 2:22 am
Suhbro, try this:
SELECT DISTINCT TOP(20) PM.Partner_Name,PL1.Location as Location_From,PL2.Location as Location_To,RS.Route_Key,RS.LeadTime_Min,RS.LeadTime_Max,CN.Begin_Journey_Date AS Start_Date,
CN.End_Journey_Date AS End_Date,RLH.Container_Key,RLH.Container_Id,RLH.Journey_Arrival_LeadTime
FROM dbo.Partner_Master PM
INNER JOIN dbo.Containers_Ended_Journey CN ON
CN.Enterprise_Partner_Key = PM.Partner_Key
INNER JOIN dbo.Route_Summary RS ON
CN.Enterprise_Partner_Key = RS.Enterprise_Partner_Key
INNER JOIN...
May 31, 2010 at 11:38 pm
Viewing 15 posts - 1,411 through 1,425 (of 1,920 total)