Forum Replies Created

Viewing 15 posts - 46 through 60 (of 151 total)

  • RE: Date

    Mike,

    The second set of data provided also contains nothing for Quarter 2 (April, May, June). Using the second set of data, here's how I get the Sum of all hours...

  • RE: Date

    Mike Levan (7/23/2008)


    here sum(Hours) will sum all the hours, i just need sum for each quarter like

    sum(1,2,3) as qtr 1

    sum(4,5,6) as qtr 2

    If I understand you, then you want the...

  • RE: Date

    From the hip:

    SELECT DatePart(yyyy,period), DatePart(qq,period), Sum(Hours)

    FROM EMP

    GROUP BY DatePart(yyyy,period), DatePart(qq,period)

    ORDER BY DatePart(yyyy,period), DatePart(qq,period)

    COMPUTE Sum(Hours) BY DatePart(yyyy,period)

    or without the COMPUTE with quarters first:

    SELECT DatePart(qq,period),

    DatePart(yyyy,period),

    Sum(hours)

    FROM dbo.emp

    GROUP BY DatePart(YYYY,period),

    DatePart(QQ,period)

    Edit: added second option.

    If you would like to...

  • RE: Date

    Take a look at the DatePart() function using qq or q as the datepart argument.

    --SJT--

  • RE: Stored Procedure Returns 0 Instead of SELECT Result

    GSquared,

    Apologies. I just noticed the OUTPUT in the actual call you posted.

    SUCCESS!

    Thank you all for your time and wattage.

    --Sauron J. Terrill--

  • RE: Stored Procedure Returns 0 Instead of SELECT Result

    As for CLR vs. xp_cmdshell:

    I actually had this working in a manual sort of way in SSMS using xp_cmdshell. My current 'solution' is using a domain administrator equivalent to run...

  • RE: Stored Procedure Returns 0 Instead of SELECT Result

    GSquared,

    Yup. I took the code you provided (thank you!) and created a new sproc using your methods. I was hoping the nested SELECT at the end for the OUTPUT parameter...

  • RE: Stored Procedure Returns 0 Instead of SELECT Result

    Jason,

    Thank you for your reply. I have read the BOL entry for CREATE PROCEDURE, and have tried versions of this sproc both with and without OUTPUT parameters. I didn't really...

  • RE: Stored Procedure Returns 0 Instead of SELECT Result

    Noeld,

    I have tried the temporary table, but I tried it again anyway. Same results.

  • RE: MSSQL install date Function

    I don't know of a function, but could you use the date the master database was created for each instance?

    --SJT--

  • RE: Combine multiple values into a single field

    Agreed on all points, GSquared. Thanks for putting in the effort to clarify.

  • RE: Combine multiple values into a single field

    As long as you're selecting just that one column to concat, there's a trick that I believe is specific to SQL Server:

    declare @table table(identifier int identity(1,1), ModuleID tinyint)

    insert into @table...

  • RE: item counting

    "PS: I'm using this to help in creating unique SKUs for auto parts where the same partnumber fits many different vehicles. "


    Couldn't figure out how get the quote to work......

  • RE: Import multi tables from access 200 to sql 2000

    There's an Import Wizard in SQL 2K. Fire up Enterprise Manager, connect to your server, and right click on your database. Select All Tasks, Import Data. That wizard should let you...

  • RE: Shall I use NULL''''s or not?

    I would add that foreign keys should never allow NULLs. Sort of defeats the purpose of an enforced relationship.

    --SJT

Viewing 15 posts - 46 through 60 (of 151 total)