Results 1 to 3 of 3

Thread: For ENIGMA....

  1. #1
    Join Date
    Nov 2003
    Location
    Romania
    Posts
    70

    Unanswered: For ENIGMA....

    This is SQL Scrip

    /************************************************** ****
    Tables Begin
    ************************************************** ****/

    ----------------------------------------------------
    -- dbo.TABLE1
    ----------------------------------------------------
    CREATE TABLE [dbo].[TABLE1]
    (
    [Day] DATETIME NOT NULL,
    [Value_1] DECIMAL(18, 2) NOT NULL,
    [Value_2] DECIMAL(18, 0) NOT NULL,
    [Grup] VARCHAR(1) NOT NULL
    );

    GO


    /************************************************** ****
    Tables End
    ************************************************** ****/

    /************************************************** ****
    Stored procedures Begin
    ************************************************** ****/

    CREATE PROCEDURE [dbo].[SP_2]
    AS
    GO


    /************************************************** ****
    Stored procedures End
    ************************************************** ****/

    /************************************************** ****
    Stored procedures Begin
    ************************************************** ****/

    ----------------------------------------------------
    -- dbo.SP_2
    ----------------------------------------------------
    ALTER PROCEDURE SP_2(@datainceput datetime, @datasfirsit datetime)
    As
    set nocount on

    DECLARE @NEWLINE AS char(1)

    SET @NEWLINE = CHAR(10)

    DECLARE @keyssql AS varchar(1000)


    SET @keyssql = 'SELECT * FROM Table1'
    + @NEWLINE + 'WHERE'
    +@NEWLINE + '[Day] BETWEEN ' + CONVERT(DATETIME, @datainceput , 104) + ' AND ' + CONVERT(DATETIME, @datasfirsit , 104)

    EXEC (@keyssql)

    GO

    /************************************************** ****
    Stored procedures End
    ************************************************** ****/

  2. #2
    Join Date
    Jul 2003
    Location
    The Dark Planet
    Posts
    1,401
    Try this and tell me what you get

    Code:
    Alter Procedure "Selectie_Date_Tabel" (@datainceput varchar(10), @datasfirsit varchar(10),@Grupa AS nvarchar(20))
    
    As
    
    set nocount on
    
    DECLARE @NEWLINE AS char(1)
    
    SET @NEWLINE = CHAR(10)
    
    DECLARE @keyssql AS varchar(1000)
    
    
    SET @keyssql = 'SELECT * FROM View2'
    + @NEWLINE + 'WHERE [Cod grupa] = ' + CHAR(39) + @Grupa + CHAR(39)
    + @NEWLINE + 'AND ([Day] BETWEEN ' + CONVERT(DATETIME, @datainceput , 104) + ' AND ' + CONVERT(DATETIME, @datasfirsit , 104) +')' 
    
    EXEC (@keyssql)
    Get yourself a copy of the The Holy Book

    order has no physical Brett in The meaning of a Kaiser . -database data

  3. #3
    Join Date
    Nov 2003
    Location
    Romania
    Posts
    70
    Im sory, don't work
    01.01.2004
    02.02.2004
    this is the date format which I use.
    My Computer Regional setting: ShortDate: dd.mm.yyyy

    It is possible that I'm wrong, but I find the solution:

    THANK FOR YOUR HELP

    Alter PROCEDURE SP_2(@datainceput datetime, @datasfirsit datetime)

    As

    set nocount on

    DECLARE @NEWLINE AS char(1)

    SET @NEWLINE = CHAR(10)

    DECLARE @keyssql AS varchar(1000)


    declare @Date_Begin as varchar(21)

    set @Date_Begin= CHAR(39) + convert(char(19),@datainceput,120)+ CHAR(39)

    declare @Date_End as varchar(21)

    set @Date_End= CHAR(39)+ convert(char(19),@datasfirsit,120)+ CHAR(39)



    SET @keyssql = 'SELECT * FROM Table1'
    + @NEWLINE + 'WHERE'
    +@NEWLINE + '[Day] BETWEEN CONVERT(DATETIME,' + @Date_Begin + ', 102)' + ' AND CONVERT(DATETIME,' + @Date_End +' , 102)'

    Print @keyssql

    EXEC (@keyssql)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •