Welcome to SPN

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

Sign Up Now!
  1.   Become a Supporter    ::   Make a Contribution   
    Target (Recurring Monthly): $200 :: Achieved: $98

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;
    >
     
Since you're here... we have a small favor to ask...

More people are visiting & reading SPN than ever but far fewer are paying to sustain it. Advertising revenues across the online media have fallen fast. So you can see why we need to ask for your help. Donating to SPN's is vote for free speech, for diversity of opinions, for the right of the people to stand up to religious bigotry. Without any affiliation to any organization, this constant struggle takes a lot of hard work to sustain as we entirely depend on the contributions of our esteemed writers/readers. We do it because we believe our perspective matters – because it might well be your perspective, too... Fund our efforts and together we can keep the world informed about the real Sikh Sikhi Sikhism. If everyone who writes or reads our content, who likes it, helps us to pay for it, our future would be much more secure. Every Contribution Matters, Contribute Generously!

    Become a Supporter      ::     Make a Contribution     



Share This Page