Forum Replies Created

Viewing 15 posts - 76 through 90 (of 150 total)

  • RE: query to fetch records of last 7 day inclu....

    I find in this situation, I like to use a variable for the cutoff day:
     
    DECLARE @dtStart datetime
    SET @dtStart = CONVERT(varchar(12), DATEADD(day, -8, GETDATE()), 101) + ' 23:59:59'
     
    SELECT ...
    FROM ...
    WHERE {date...

  • RE: Referencing a Group Value from an Inner Group Value

    Gentlemen,
     
    I believe the SUM aggregate function takes two parameters with the second parameter being optional.  The second parameter is group level you want the SUM to be taken from.  ie.. ...

  • RE: stored procedure and multiple rows

    There are a couple of different ways this could be handled and still use the SP you have created.

     

    1.  Load the results of your select statement into a temp table...

  • RE: inserting multiple insert statement questions

    Patrick,
     
    Do you have multiple product tables or one product table with multible productname fields?  From your first post to your second it changes.
     
    Either way, I believe you will have to...

  • RE: Count of trouble_codes per store_id

    Try using multiple case statements.  One case statement for each code.
     
    select table1.store_id,

    SUM(Case when table2.trouble_code='101258' then 1 else 0 end) as Code_Theft,

    SUM(Case when table2.trouble_code='101259' then 1 else 0 end) as Code_Fire,

    etc...

    from...
  • RE: how do I avoid duplicate entries?

    This is a question for Aaron,

    Would the following work also:

     

    INSERT INTO AP_Job_Cost_Security22 (Operator_ID, Operator_Name, Email_Address, Master_Job, Company_Code)

    SELECT DISTINCT O.Operator_ID,O.Operator_Name, O.Email_Address, U.Job_number, U.Company_Code

    FROM JC_JOB_USER_FIELDS_DET_MC U INNER JOIN pa_operator_master O ON U.alpha_Field...

  • RE: need help with this report

    Try this Store Procedure:  (Change the table 'TableBreakdown' to what ever the name of your table is)

     

    CREATE PROCEDURE p_Rpt_AvailStatus (

     @tiStartHour tinyint,

     @tiStartMinute tinyint,

     @tiEndHour tinyint,

     @tiEndMinute tinyint)

      AS

    SET NOCOUNT ON

    DECLARE @vcStatus varchar(15),

     @tiSHour tinyint,

     @tiSMinute tinyint,

     @tiEHour tinyint,

     @tiEMinute tinyint,

     @iDuration int

    DECLARE @tblReport table (vcStatus varchar(15), vcStart varchar(4), vcEnd...

  • RE: "Column encryption" software recommendations?

    I have had some success working with a product called 'xp_Crypt'.

     

    If you would like to look into this product, check out 'www.activecrypt.com'. 

     

    I had a need to encrypt account numbers...

  • RE: Please help with SQL statement.

    No skin of my nose.  It is just a solution that is KISS.

     

    Dave N

  • RE: Please help with SQL statement.

    while x <= 12

    begin

         select customerid, month, year

         from historytable

         where month = x

         group by customerid, month, year

        having count(month) = 0

     

        set x = x + 1

    end

  • RE: Please help with SQL statement.

    Ok,

     

    Then put it in a while loop.  You then have one select statements and all 12 months are covered.

    declare x int

    set x = 1

    while x <= 12

    begin

         select statement

     

     

    Dave N

  • RE: Please help with SQL statement.

    Since there is only 12 months in a year, why not just keep this very simple at create twelve select statements, one for each month, that returns any entries that...

  • RE: the method of dealing with space in field is not good

    The answer to your question can be found in Books Online.  Search for this topic, 'Using char and varchar Data'.  Basically, it states that the data type varchar truncates all...

  • RE: Allow non-sysadmins to amend ''''sa'''' jobs

    One possible method is to use the DMO objects and create a custom front end for the SQL Server Scheduled jobs.  This would take some work to develop, but once...

  • RE: Compression tool???

    Wayne,

     

    Yes, that is exactly what we would like to do.  We are looking at building a Bill Statement presentation web app.  We would need to store 6 months of bill...

Viewing 15 posts - 76 through 90 (of 150 total)