Welcome to SPN

Register and Join the most happening forum of Sikh community & intellectuals from around the world.

Sign Up Now!

SQL Syntax Error???

Discussion in 'Information Technology' started by munkis29@yahoo.com, Jul 28, 2006.

Tags:
  1. munkis29@yahoo.com

    munkis29@yahoo.com
    Expand Collapse
    Guest

    Hey All,

    I wrote this code in SQL View Query window but when I try to save it, I
    get an error box that says "Syntax Error in FROM clause" I've tried a
    few different variations in the syntax but still to no avail. Hopefully
    someone can look this over and tell me what I'm doing wrong, thanks in
    advance. (Using Access 2003 by the way)

    SELECT FileID FROM Test2
    DECLARE @test AS int, @ctr AS int
    SET @test = FileID
    SET @ctr = .1

    IF @test = FileID
    SET FileID = FileID + ctr
    SET @ctr = @ctr + .1
    ELSE
    SET @ctr = .1
    END IF;
     
  2. Loading...

    Similar Threads Forum Date
    Microsoft Brings 64-Bit Perks in SQL Server 2000 Service Pack (Ziff Davis) Interfaith Dialogues May 7, 2005

  3. Danny J. Lesandrini

    Danny J. Lesandrini
    Expand Collapse
    Guest

    First, this only runs on SQL Server. Access doesn't support any of this.
    Second, the correct syntax is ...

    SELECT FileID FROM Test2
    DECLARE @test AS int, @ctr AS int
    SET @test = FileID
    SET @ctr = .1

    IF @test = FileID
    begin
    select FileID = FileID + ctr
    select @ctr = @ctr + .1
    end
    ELSE
    SET @ctr = .1

    My edits are in lower case and I deleted the END IF.
    --

    Danny J. Lesandrini
    dlesandrini@hotmail.com
    http://amazecreations.com/datafast


    <munkis29@yahoo.com> wrote in message news:1149173371.161226.19100@c74g2000cwc.googlegroups.com...
    > Hey All,
    >
    > I wrote this code in SQL View Query window but when I try to save it, I
    > get an error box that says "Syntax Error in FROM clause" I've tried a
    > few different variations in the syntax but still to no avail. Hopefully
    > someone can look this over and tell me what I'm doing wrong, thanks in
    > advance. (Using Access 2003 by the way)
    >
    > SELECT FileID FROM Test2
    > DECLARE @test AS int, @ctr AS int
    > SET @test = FileID
    > SET @ctr = .1
    >
    > IF @test = FileID
    > SET FileID = FileID + ctr
    > SET @ctr = @ctr + .1
    > ELSE
    > SET @ctr = .1
    > END IF;
    >
     

Share This Page