Forum Replies Created

Viewing 15 posts - 1,411 through 1,425 (of 1,920 total)

  • RE: Two Temp Tables within a Proc

    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...

  • RE: Help to understand CROSS JOIN

    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 ...

  • RE: Add 2 columns in one sql statement

    You're welcome buddy 🙂

  • RE: list of indexes

    ~Edit: Wrong code at wrong place :sick:

  • RE: Add 2 columns in one sql statement

    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

  • RE: Tricky substring

    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...

  • RE: Tricky substring

    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..

  • RE: auto number data tye

    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...

  • RE: Auto Increment Alphabet

    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...

  • RE: select statement to display year

    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...

  • RE: TSQL Return start/end price and start/end datetime by product name.

    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...

  • RE: Problem - Stored Pocedure

    You're welcome Subhro! 🙂

  • RE: select statement to display year

    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...

  • RE: select statement to display year

    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...

  • RE: Problem - Stored Pocedure

    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...

Viewing 15 posts - 1,411 through 1,425 (of 1,920 total)