Forum Replies Created

Viewing 15 posts - 2,161 through 2,175 (of 3,544 total)

  • RE: Question on stored procedure

    quoteIsn't there a problem in SQL Server where, in a stored proc, SQL statements that follow a RETURN...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question on stored procedure

    Is the error

    Violation of PRIMARY KEY constraint. Cannot insert duplicate key in object

    or

    Cannot insert duplicate key row in object

    If it is the latter then the error is probably due to...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Group dates by company QTR

    How about this for a start

    SELECT [Year],[Qtr],SUM([value]) AS [value]

    FROM (SELECT [Year],DATEPART(quarter,[Date])+1 AS [Qtr],[value]

    FROM

    WHERE [Month] < 10

    UNION

    SELECT [Year]+1,1 as [Qtr],[value]

    WHERE [Month] >= 10

    FROM...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Question on stored procedure

    I'd guess that

    @FullName exists in Users

    but

    @username does not exists in [Employees]

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: write result in excel file.

    quoteHow do you setup the excel file (details please)?

    Unless that is is a rhetorical question

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Using BCP for import

    This is what I would do in this order

    Run BCP out to genrate bcp.fmt file

    Edit bcp.fmt and remove unwanted columns

    Put the columns into the sequence of the input file (cut...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Summary of 2 date periods in one table

    Try this

    DECLARE @startdate datetime

    SET @startdate = '20050901'

    SELECT @startdate+n.number,DATEPART(dw,@startdate+n.number),

    DATENAME(dw,@startdate+n.number) AS [Date],

    SUM(ISNULL(t.ThisPeriod,0)) AS [ThisPeriod],

    SUM(ISNULL(l.LastPeriod,0)) AS [LastPeriod]

    FROM master.dbo.spt_values n

    LEFT OUTER JOIN

      (SELECT DATEPART(dw,ot.dtStamp) AS [dayno],SUM(ot.OrderNet)...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Designe issue

    quotehave 10 district each have say 1 million school's(i have taken this school district as just an example...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: hours and minutes calculation

    DATEADD(minute,SUM(DATEDIFF(minute,0,CAST(REPLACE(CAST([timecol] as varchar),'.',':') as smalldatetime))),0)

    This will give you datetime value which you can then process, cast or convert as necessary

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Functions as arguments to Functions?

    Not exactly true.

    You can use GETDATE() as a parameter to a Scalar Function

    but not as a paramenter to an Inline Table-valued Function

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: write result in excel file.

    Providing the excel file exists

    INSERT INTO

    OPENROWSET('Microsoft.Jet.OLEDB.4.0',

    'Excel 8.0;Database=C:\temp\book1.xls', [sheet1$])

    (col1,col2,col3)

    SELECT col1,col2,col3 FROM

     

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Functions as arguments to Functions?

    As parameters to functions can only be parameters or constants, the cast statement is neither.

    Do as Kenneth suggests or change the input to the function to int

    Create Function dbo.Pledge_Match(@campaign_year int) ...

    and use

    Select *...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Multiple column left outer join for gurus

    Your query will return the results posted with the data you posted.

    What do you mean by not working?

    Check what is being returned from the subqueries, if either of them return...

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: 5000 posts....new contest

    quote...and who guillotined you ?!

    Well, sushila, half a pic is better than none

    Far away is close at hand in the images of elsewhere.
    Anon.

  • RE: Stored Procedure and Batch File Problem

    May sound silly but does the input exactly match the filenames including zero and oh, five and s etc

    Far away is close at hand in the images of elsewhere.
    Anon.

Viewing 15 posts - 2,161 through 2,175 (of 3,544 total)