Forum Replies Created

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

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

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

  • RE: Question on stored procedure

    I'd guess that

    @FullName exists in Users

    but

    @username does not exists in [Employees]

     

  • RE: write result in excel file.

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

    Unless that is is a rhetorical question

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

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

  • RE: Designe issue

    quotehave 10 district each have say 1 million school's(i have taken this school district as just an example...
  • 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

     

  • 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

  • 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

     

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

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

  • RE: 5000 posts....new contest

    quote...and who guillotined you ?!

    Well, sushila, half a pic is better than none

  • 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

  • RE: Stored Procedure and Batch File Problem

    Put

    ECHO Finished

    after last xcopy and before :Finish label and see if the text 'Finished' appears in the miss.log

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