Forum Replies Created

Viewing 14 posts - 121 through 134 (of 134 total)

  • RE: how can i get the number with prefixing zeors in a select query

    for the number column col1 : ( result has length 14 )

    select col1 = case when col1 < 0 then '-' else '' end + right(replicate('0',14) + convert(varchar(255),abs(col1)),14)

    for the date column :

    select col2...

  • RE: Database backup

    Maybe you should verify sp_configure 'media retention'. You could add RETAINDAYS = 5 to make sure you can overwrite the file, or you could use the SKIP option ...

     

    Important  If...

  • RE: sql query requirement

    You can copy/paste the following lines. Whiles explaining the query, I changed it a little bit. This new "explained" (?) query should do it :

    /*

    Shankar query :

    I will try to...

  • RE: sql query requirement

    Oops, you do not want the max(dte) fro the first month ? :

     

    select dte from

    (

    select top 6 B.dte

    from

    (

      select id='999999999',dte = min(dte) from...

  • RE: sql query requirement

    19 Mar 2004 is not in the input ... I supposed only records in the input table should come up ?

  • RE: sql query requirement

    the query I posted should do this, but will not work if the dates are not in the same year. This new query should do the job.

    query :

    select dte...

  • RE: sql query requirement

    As mentioned in the stored procedure, I did not understand the requirements for that part.

    This query should do it :

    select top 6 B.dte

    from

    (

      select id=1,dte = min(dte) from dbo.tst

     union all

      select...

  • RE: sql query requirement

    This query should do exactly the same as my stored procedure :

     

    select top 6 B.dte

    from

    (

      select id=1,dte = min(dte) from dbo.tst

     union all

      select id=2,dte =...

  • RE: sql query requirement

    Just change the first 'order dte asc' to 'order by dte desc' :

     

    create procedure dbo.Shankar as

    begin

     set nocount on

     declare @result_table table

     (  dte datetime not null UNIQUE clustered  )

     declare @mindte datetime,

      @maxdte datetime,

      @curdte datetime,

      @count...

  • RE: sql query requirement

    What do you mean with 'i need to use SQL's only'. Do you want anly select statements ? I do not think it is possible to do this without some...

  • RE: Triggers to create String ID

    I would suggest to use a extra identity column to handle this. Here is the output of 2 possible solutions you can find in my test script :...

  • RE: Get rid of dt Stopred Proceduress (version control)

    A new database is a copy of the model database.

    So drop the stored procedures you do not need from model, and the newly created databases want have them.

  • RE: datetime query

    select TABLE_NAME,COLUMN_NAME

    from INFORMATION_SCHEMA.COLUMNS

    where DATA_TYPE = 'datetime'

  • RE: Question of the Day for 02 Mar 2004

    I even tried the statement

    sp_tableoption Employee, 'text in row', 2000

    on a test table, and this statement is also correct. I realy do not understand what 's wrong doing this in...

Viewing 14 posts - 121 through 134 (of 134 total)