Forum Replies Created

Viewing 15 posts - 886 through 900 (of 1,497 total)

  • RE: SQL Queries - Parallelism

    To get parallel processing to work, I think you will either have to combine all your queries into one with something like UNION ALL, or write an async CLR SP.

    Also,...

  • RE: Help: How to flatten results

    Use the ROW_NUMBER() function to work out which row the information should be on.

    Also, PIVOT tends to be more readable than lots of CASE statements.

    Try something like:

    SELECT SYear, SWeek

    ,[2] AS...

  • RE: Select on Oracle linked server table.

    The problem may be that all 1.3 million rows are being sent to the MSSQL instance before the filter is applied.

    This could take a long time on a slow link.

    Try:

    1....

  • RE: Performance issue

    On the limited amount of informaton provided, it is difficult to say how to improve the performance.

    The main problem is the CHARINDEX(@query, a.account) > 0, or the equivalent a.account...

  • RE: Is there a more efficient way to write this query?

    On looking at it again, maybe the following:

    SELECT

    CASE

    WHEN N.N = 1

    THEN 'FreeSpace'

    ELSE 'UsedSpace'

    END AS Measurement

    ,CASE

    WHEN N.N = 1

    THEN FreeSpaceMB

    ELSE UsedSpaceMB

    END AS SizeInMB

    FROM

    (

    SELECT FreeSpaceMB, UsedSpaceMB

    ,ROW_NUMBER() OVER (ORDER BY EntryDateTime DESC) AS...

  • RE: Is there a more efficient way to write this query?

    I am not sure what you are trying to do. If you want the latest information for each drive then try something like:

    SELECT fkServerID, DriveLetter, FreeSpaceMB, UsedSpaceMB

    FROM

    (

    SELECT fkServerID, DriveLetter, FreeSpaceMB,...

  • RE: SQL Join Help

    As you have an aggregate function on OrderDate it does not make much sense to have it in the GROUP BY clause.

    Try:

    GROUP BY I.ProductID, I.Description, I.UnitsInStock, I.UnitPrice, I.Expires--, O.OrderDate

    Edit: Using...

  • RE: TRY and CATCH has no real use?

    As you have not raised an error or returned within the CATCH block I think the code will continue to execute.

    (Edit: This will depend on what XACT_ABORT is set to.)

    Try...

  • RE: Complicated Stored Procedure Help

    netguykb (2/2/2010)


    NO IDEA How to do this. Here is what I have so far and I know this is not right considering the where clause is only allowing me to...

  • RE: T-SQL Stored Proc calling T-SQL Function

    If you do not have access to the application code, you could look at using a trigger to clean the data as it was being saved.

  • RE: Query about joins

    Also what’s better for which cases.

    “JOIN ON(tableA.id=tableB.id)” or a regular select with “Where (tableA.id=tableB.id)”

    With inner joins where the filter is applied seems to make no difference. The optimizer generally sorts...

  • RE: Trying to join three tables with no success

    You may want to redesign your schema.

    With your current schema, something like the following may work:

    SELECT dCats.[NAME]

    ,refTable.[Id]

    ,'Default' AS CatType

    FROM tbl_categoriesRefTable AS refTable

    JOIN tbl_defaultCategories AS dCats

    ON dCats.defaultCategoryId = refTable.defaultCategoryId

    AND dCats.universityId =...

  • RE: foreign key

    ALTER TABLE dbo.docfol

    ADD CONSTRAINT FK_folderid_folder

    FOREIGN KEY folderid

    REFERENCES dbo.folder(folderid)

    GO

    ALTER TABLE dbo.docfol

    ADD CONSTRAINT FK_docid_document

    FOREIGN KEY docid

    REFERENCES dbo.document(docid)

    GO

Viewing 15 posts - 886 through 900 (of 1,497 total)