Forum Replies Created

Viewing 15 posts - 31 through 45 (of 424 total)

  • RE: Inserting Default Values Using CASE Statement

    suggestion: insert a row of default values and then update that row with the passed values.

    create table #test ( k int identity(1,1), a int default 22, b varchar(99) default 'missing',

    ...

  • RE: Executing Multiple Saved Queries at One Time

    use sqlcmd and a command file (batch file):

    sqlcmd -S myserver -d dbname -U user -P password -i file1.sql -o file1.log

    sqlcmd -S myserver -d dbname -U user -P password...

  • RE: Complex Parameter display

    you'd have to create your own gui component for collecting those parameters. if you just use SSRS' automatically generated entry panel, all parameters will be displayed.

  • RE: Parameter and 2nd dataset

    report parameters are global, so just reference it in the other dataset.

  • RE: SSRS - Count of Distinct People Where Gender =

    add another dataset based on the sql you already mentioned. then reference the first row and last row of that dataset in your expressions (if sorted by gender, Females...

  • RE: Occasional error?!

    Ninja's_RGR'us (12/5/2008)


    I have this expression in a report : =IIF(CINT(SUM(Fields!QteFacture.Value)) = 0, -1, SUM(Fields!MontantFacture.Value) / SUM(Fields!QteFacture.Value))

    half the time, the -1 value shows up, and the other half I get a...

  • RE: Add Sum at the end of the column!

    ISNULL(a.DEClearedDate, b.SomaticClearedDate, c.PsycClearedDate) AS ClearedDate

    isnull can only accept 2 parameters. you can use coalesce() or multiple isnull()s.

    COALESCE(a.DEClearedDate, b.SomaticClearedDate, c.PsycClearedDate) AS ClearedDate

    ISNULL(a.DEClearedDate, ISNULL(b.SomaticClearedDate, c.PsycClearedDate)) AS ClearedDate

  • RE: find @mon and @fri based on date

    Lowell:

    I use the function below (created in our global db):

    SET ANSI_NULLS ON

    GO

    SET QUOTED_IDENTIFIER ON

    GO

    create function [dbo].[fGetDayInWeek]( @date smalldatetime, @dayOfWeek tinyint )

    returns smalldatetime

    as begin

    return dateadd( day, @dayOfWeek -...

  • RE: Add Sum at the end of the column!

    josephptran2002:

    You can use "WITH ROLLUP" to produce the total line. Look it up in the SQL documentation.

    WITH CTE AS

    ( SELECT ISNULL(a.DECleared, 0) + ISNULL(b.SomaticCleared,...

  • RE: concatenating binary data

    Tom,

    I kept fiddling with this and came up the following:

    declare @bin_data table (category int, data varbinary(8))

    insert @bin_data (category, data)

    SELECT 1, CAST(0x2142434445464748 AS VARBINARY(8) )

    union SELECT 1, CAST(0x3162636465666768 AS VARBINARY(8))...

  • RE: Opinions Needed

    the CASE function can only be used to return a value. it can't be used to limit WHERE clause comparisons. also, you can't declare variables within a sql...

  • RE: concatenating binary data

    you said your example was a simplication, but why can't you just use the + operator?

    select CAST(0x4142434445464748 AS VARBINARY(8) )

    + CAST(0x6162636465666768 AS VARBINARY(8)) as result

    result: 0x41424344454647486162636465666768

    using xml to...

  • RE: No "Invalid Column Name" Error When Using "IN"

    SELECT a_id FROM dbo.a WHERE a_id IN (SELECT a_id FROM dbo.b)

    In the above statement, the table dbo.a and thus the column a_id is in scope and accessible in the sub-query....

  • RE: Setbased Percentage Increase?

    select D1.DriveLetter,

    sum(D1.FreeMB) as free_mb_start, sum(D2.FreeMB) as free_mb_end,

    (sum(D2.FreeMB) / sum(D1.FreeMB) * 100) - 1 as percent_change

    from dbo.vw_DriveSpaceHistory as D1

    join dbo.vw_DriveSpaceHistory as D2

    on D1.DriveLetter = D2.DriveLetter

    where D1.DTStamp =...

Viewing 15 posts - 31 through 45 (of 424 total)