Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)

  • RE: Update with zero

    If yourcolumn is defined as char(4) then the following will work

    update yourtable set yourcolumn =

    case when isnumeric(yourcolumn) <> 0 then right(rtrim(stuff(yourcolumn,1,0,'000')),3)  else right(rtrim(stuff(yourcolumn,1,0,'000')),4) end

    Otherwise,if yourcolumn is defined as...

  • RE: Need A Query

    Using a temporary table to 1. get the records with gap of 10 between them , then add the minimum value for any records not existing in the table.

    declare @WithinValue...

  • RE: Need A Query

    Not sure how efficient this would be ... but hopefully better than a cursor...

    CREATE TABLE [Test] (

     [ID] [varchar] (5) NOT NULL ,

     [N1] [integer] NOT NULL )

    GO

    Insert into Test (ID,N1) values(0006,5)

    Insert...

  • RE: SQL Code Help...Important!

    Check your column names in joins & order by clause

    If this doesn't fix problem , then what is the syntax error, and what are the datatypes of each column?

    SELECT C.CUSTOMER_NAME,...

  • RE: Add Columns Representing Monthly Values

    How would you recommend refactoring this solution ...It really depends on how the data is stored and what you’re expecting to retrieve.

    May 25, 2004 at 8:19 pm

    #507784

  • RE: Add Columns Representing Monthly Values

    CREATE PROCEDURE GetRangeTotal @FromDateEnt smalldatetime,@ToDateEnt smalldatetime

    as

    DECLARE @FromYear AS int

    DECLARE @ToYear AS int

    DECLARE @FromMonth AS int

    DECLARE @ToMonth AS int

    SET @FromYear = YEAR(@FromDateEnt)

    SET @ToYear = YEAR(@ToDateEnt)

    SET @FromMonth = MONTH(@FromDateEnt)

    SET @ToMonth = MONTH(@ToDateEnt)

    SELECT...

  • RE: Saving Enterprise Manager Diagram to a file.

    You can save diagram to a pdf file.

    Download a pdf printer driver (eg pdf995.exe). Then from EM diagram, select print and select your pdf printer.

  • RE: What data type supports 2000 characters or more?

    In SQL 2000, varchar will support a max of 8000 chars,  nvarchar will support a max of 4000 chars, text supports up to 2gb of data (and, as you noticed in...

  • RE: stored Procedure

    declare @insertSql varchar(5000)

    set @insertSql='Insert into RMCPL_MAIL_HD(RMCPL_DT,RMCPL_SUB,rmcpl_usr) values(' + '''12/12/2004'',' + '''llolove'',27)'

     

    Alternatuvely, you should be able to create a function quotename()

    see article for description, which would make code a more readable

  • RE: Edition

    In version 8 you can also use ServerProperty, I think it was also available in v7

    select Serverproperty('Edition')

    This will provide output eg: Desktop Engine

  • RE: How to delete all but 1?

    and then:

    set rowcount 0

Viewing 11 posts - 1 through 11 (of 11 total)