Forum Replies Created

Viewing 15 posts - 136 through 150 (of 268 total)

  • RE: Performance Issues

    400,000 records is not a big number of records. I have runs with populate tables with with anything upto 50 million records.

    There could be lots of reasons why some...

  • RE: help need

    If I understand, you are getting the criteria from a list box from a screen.

    My suggestion is:

    create procedure [dbo].[query] @ProgramType char(1), @AccountName char(1), @ProgramStatus char(1)

    as

    select ProgramId ProgramType AccountName ProgramName ProgramBudget...

  • RE: converting a large number to format nnnk

    This might do the trick.

    create function dbo.fn_format (@string as varchar(25))

    returns varchar(25) as

    begin

    if @string > 1000000 set @string = left(@string,len(@string)-6) + '.' + substring(@string,len(@string)-5,1) + 'M'

    else if @string > 1000 set...

  • RE: How to pronounce SQL

    Hedging my bets here but it depends:

    1. SQL Server = Sequel Server

    2. SQL statements = S Q L statments

    Jeremy

  • RE: Am I crazy?

    Interesting timings - you learn something new everyday.

    The index was probably not chosen because indexes are only useful when retrieving less than ~5% of the rows. The query is...

  • RE: trimming trailing spaces and zeros from a string

    Alternatively, try a user defined function:

    create function dbo.fn_RemoveTrailingZeros ( @string varchar(25) )

    returns varchar(25) as

    begin

    declare @loop char(1)

    set @loop = 'Y'

    while @loop = 'Y' begin

    if right(@string,1) not in ('0','.') begin

    ...

  • RE: Am I crazy?

    Is the query in the previous actually that efficient?

    IMHO, for each row in the outer select statement it will evaluate the subselect statement - as there in no where clause...

  • RE: Need help in creating dynamic fields

    Frank,

    Thanks

    Jeremy

  • RE: Need help in creating dynamic fields

    Frank,

    I've read your article and I am a bit confused.

    I accept the performance overhead of dynamic SQL (not caching query plans) and the security aspects (giving specific permissions on tables...

  • RE: Need help in creating dynamic fields

    If the array that is passed to the sp is comma delimted (e.g. col1, col2, col3) then you could use dynamic sql to create the statement:

    declare @sqlString nvarchar(4000)

    set @sqlstring =...

  • RE: primary constraint combination of columns

    It means that the combination of the two columns must be unique.

    Jeremy

  • RE: User Define Function error

    It works fine on my server. It might be a setting problem - how SQL Server formats dates?

    Jeremy

  • RE: inserting a value

    If I understand it, you want to put a 4 at the start of the value:

    select '4' + <colname>

    from <table>

    HTH

    Jeremy

  • RE: Complex view

    You can use the UNION operator to concatentate the results from different tables:

    Select Distinct AttributeID,

    CASE dbo.QIMS_FORMS_INSTANCE_DATA.ColumnID WHEN 1 THEN

    dbo.QIMS_FORMS_INSTANCE_DATA.Data End AS Target,

    CASE dbo.QIMS_FORMS_INSTANCE_DATA.ColumnID WHEN 2 THEN

    dbo.QIMS_FORMS_INSTANCE_DATA.Data End AS...

  • RE: Complex view

    You can use case statements to denormalise data:

    select distinct AttributeId,

    case ColumnID when 1 then Data else 0 as col1

    case ColumnID when 2 then Data...

Viewing 15 posts - 136 through 150 (of 268 total)