Forum Replies Created

Viewing 15 posts - 301 through 315 (of 595 total)

  • RE: Please HELP!! SQL Trigger

    I don't see a reason why not, however, I would suggest that the more verbose solution you had before might actually be a little more maintainable/readable, especially if your are...

  • RE: Combining Two Grouping Select Statements

    With all the time we spent on this thread you probably could have just done 2 calls to the database, and used the results of the second call in your...

  • RE: Combining Two Grouping Select Statements

    OK, completely different strategy. What about this:

    
    
    SELECT TOP 100 PERCENT
    ISNULL(dbo.Defect_Data.UDL4, 'Unknown') AS WSI
    , COUNT(dbo.Defect_Data.DataID) AS QDefectCount
    , SUM(dbo.Defect_Data.SUMDEFECTS) AS DefectSum
    FROM dbo.Defect_Data
    WHERE (DATETIME >=...
  • RE: help selecting sums from two similar tables

    I forgot the FROM clause

    try:

    
    
    SELECT thismonth, thisyear, SUM(monthlysum)
    FROM
    (SELECT ... rest of code

    sorry bout that one...

  • RE: Need to isolate string portion

    Just be careful of addresses like "13 Barton Street #200". My solution would leave these types of records unaffected and rely on either a more complex where condition, or...

  • RE: SELECT short date

    Like I said, strip the time:

    
    
    CREATE VIEW dbo.vwImport
    AS
    SELECT DATEADD(d, 0, DATEDIFF(DAY, 0, dbo.tblSHOrderItems.dteShipped)) AS dteShipped, dbo.tblSHOrderItems.txtInvNum, dbo.tblSHOrderItems.txtSuffix, dbo.tblSHOrdHead.txtCustomerPO,
    SUM(dbo.tblSHOrderItems.intQuantity * dbo.tblSHOrderItems.curPrice) AS subtotal, dbo.tblSHOrdHead.curTaxAmt, dbo.tblSHOrdHead.pk,
    SUM(dbo.tblSHOrderItems.intQuantity...
  • RE: Combining Two Grouping Select Statements

    quote:


    To be more specific, I am trying to obtain the total of questionnaires in the

    query per "WSI" as opposed to the percentage...

  • RE: Need to isolate string portion

    
    
    -- St and Rd first
    UPDATE MyTable
    SET Address = SUBSTRING(AddressField, LEN(RTRIM(AddressField))-3, LEN(RTRIM(AddressField)))
    WHERE RIGHT(RTRIM(AddressField, 3)) = ' St'
    OR RIGHT(RTRIM(AddressField, 3)) = ' Rd'

    I think you could use the...

  • RE: SELECT short date

    here's just a different variation:

    
    
    SELECT DATEADD(d, 0, DATEDIFF(DAY, 0, GETDATE()))
  • RE: SELECT short date

    USE:

    
    
    CONVERT(DATETIME, DATEDIFF(DAY, 0, GETDATE()))

    to strip the time portion of the date.

    Edited by - jpipes on 06/18/2003 12:20:51 PM

  • RE: Combining Two Grouping Select Statements

    In your last query, your are not grouping by the same number of columns you are trying to aggregate, so my guess is you are receiving an error saying "is...

  • RE: help selecting sums from two similar tables

    Don't do the CHAR(6) conversion. Not necessary. Try this:

    
    
    SELECT thismonth, thisyear, SUM(monthlysum)
    (
    SELECT
    DATEPART(MONTH, invodate) as thismonth
    , DATEPART(YEAR, invodate) as thisyear
    , ISNULL(SUM(docamnt), 0)...
  • RE: Key Items

    ROCKO, not quite sure what you're going for here...

    To set up a multi-column primary key, check BOL ALTER TABLE help article...gives examples of the ALTER TABLE ADD CONSTRAINT statement with...

  • RE: Please HELP!! SQL Trigger

    It looks like a fairly clean trigger already. What you could do to make it a little less repetitive or verbose is declare some variables for the keyn, tbln,...

  • RE: Design using across database tables

    Hey, Tom, we had a good discussion about this back in November. Here's the thread on it; you might find some good opinions...

    http://www.sqlservercentral.com/forum/topic.asp?TOPIC_ID=8029&FORUM_ID=49&CAT_ID=1&Topic_Title=One+or+More+than+One+Database%3F&Forum_Title=Strategies

Viewing 15 posts - 301 through 315 (of 595 total)