[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 952
  • Last Modified:

Script Error: Incorrect syntax near 'int'.

Hi
I am trying to run a script and it is generating a Incorrect Syntax error.
The script is attempting to create a temporary table and it  inserts the values of an existing table into the new temp table.

Here is the script. The error in on line 3 Full Error: Server: Msg 170, Level 15, State 1, Line 3
Line 3: Incorrect syntax near 'int'.
Server: Msg 156, Level 15, State 1, Line 33
Incorrect syntax near the keyword 'NULL'.

There is actually two errors but I though I'd save that till I sort the first one.

USE [BOI]
go
SET IMPLICIT_TRANSACTIONS ON
go
CREATE TABLE [dbo].[MerchantAccountTemp] (
      [Merchant Account ID] [int] IDENTITY (1, 1) NOT NULL ,
      [Merchant ID] [int] NULL ,
      [Account Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Account Bank] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Mode] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [OPS ID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [BOI Login Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [BOI Password] [varchar] (500) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Settlement Password] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Refund Password] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Void Password] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Enquiry Password] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Last Sequence Number] [int] NULL ,
      [Extra 1 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Extra 2 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Extra 3 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Extra 4 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Extra 5 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Extra 6 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Extra 7 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Extra 8 Field Name] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [Is Active] [bit] NULL ,
      [Duplicate Time] [int] NULL ,
      [InvalidLimit] [int] NULL ,
      [InvalidTimePeriod] [int] NULL ,
      [FilterOn] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [EmailClient] [varchar] (3) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [RequireCVC] [bit] NULL ,
      [BOIVersion] [nvarchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [WestpacMerchantID] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [WestpacSecurityNumber] [nvarchar] (10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
      [WestpacMerchantName] [nvarchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
INSERT INTO [MerchantAccountTemp] (
      [Merchant Account ID],
      [Merchant ID] [int] NULL ,
      [Account Name] [varchar] ,
      [Account Bank] [varchar] ,
      [Mode] ,
      [OPS ID] ,
      [BOI Login Name] ,
      [BOI Password] ,
      [Settlement Password] ,
      [Refund Password] ,
      [Void Password] ,
      [Enquiry Password] ,
      [Last Sequence Number] ,
      [Extra 1 Field Name] ,
      [Extra 2 Field Name] ,
      [Extra 3 Field Name] ,
      [Extra 4 Field Name] ,
      [Extra 5 Field Name] ,
      [Extra 6 Field Name] ,
      [Extra 7 Field Name] ,
      [Extra 8 Field Name] ,
      [Is Active] ,
      [Duplicate Time] ,
      [InvalidLimit] ,
      [InvalidTimePeriod] ,
      [FilterOn] ,
      [EmailClient] )

      SELECT

      [Merchant Account ID],
      [Merchant ID] [int] NULL ,
      [Account Name] [varchar] ,
      [Account Bank] [varchar] ,
      [Mode] ,
      [OPS ID] ,
      [BOI Login Name] ,
      [BOI Password] ,
      [Settlement Password] ,
      [Refund Password] ,
      [Void Password] ,
      [Enquiry Password] ,
      [Last Sequence Number] ,
      [Extra 1 Field Name] ,
      [Extra 2 Field Name] ,
      [Extra 3 Field Name] ,
      [Extra 4 Field Name] ,
      [Extra 5 Field Name] ,
      [Extra 6 Field Name] ,
      [Extra 7 Field Name] ,
      [Extra 8 Field Name] ,
      [Is Active] ,
      [Duplicate Time] ,
      [InvalidLimit] ,
      [InvalidTimePeriod] ,
      [FilterOn] ,
      [EmailClient]
      
      FROM
      [MerchantAccount]

go
COMMIT
go

Any ideas on the incorrect syntax error on line 3
0
Asparona
Asked:
Asparona
  • 3
2 Solutions
 
hongjunCommented:
Use this

INSERT INTO [MerchantAccountTemp] (
      [Merchant Account ID],
      [Merchant ID] ,
      [Account Name] ,
      [Account Bank] ,
      [Mode] ,
      [OPS ID] ,
      [BOI Login Name] ,
      [BOI Password] ,
      [Settlement Password] ,
      [Refund Password] ,
      [Void Password] ,
      [Enquiry Password] ,
      [Last Sequence Number] ,
      [Extra 1 Field Name] ,
      [Extra 2 Field Name] ,
      [Extra 3 Field Name] ,
      [Extra 4 Field Name] ,
      [Extra 5 Field Name] ,
      [Extra 6 Field Name] ,
      [Extra 7 Field Name] ,
      [Extra 8 Field Name] ,
      [Is Active] ,
      [Duplicate Time] ,
      [InvalidLimit] ,
      [InvalidTimePeriod] ,
      [FilterOn] ,
      [EmailClient] )

      SELECT

      [Merchant Account ID],
      [Merchant ID] ,
      [Account Name] ,
      [Account Bank] ,
      [Mode] ,
      [OPS ID] ,
      [BOI Login Name] ,
      [BOI Password] ,
      [Settlement Password] ,
      [Refund Password] ,
      [Void Password] ,
      [Enquiry Password] ,
      [Last Sequence Number] ,
      [Extra 1 Field Name] ,
      [Extra 2 Field Name] ,
      [Extra 3 Field Name] ,
      [Extra 4 Field Name] ,
      [Extra 5 Field Name] ,
      [Extra 6 Field Name] ,
      [Extra 7 Field Name] ,
      [Extra 8 Field Name] ,
      [Is Active] ,
      [Duplicate Time] ,
      [InvalidLimit] ,
      [InvalidTimePeriod] ,
      [FilterOn] ,
      [EmailClient]
     
      FROM
      [MerchantAccount]
0
 
hongjunCommented:
There's no need to have NULL and datatypes in the insert and select statements.

hongjun
0
 
AsparonaAuthor Commented:
Thanks for your quick response.

I didn't notice that until I viewed my question in my browser.

I fixed the script and all it working now.

I was going to delete my question but you were too fast!

Way to go, you deserve the points.
0
 
hongjunCommented:
Glad you solved your problem especially when it's you yourself who solved it :)
0
 
Guy Hengel [angelIII / a3]Billing EngineerCommented:
>There's no need to have NULL and datatypes in the insert and select statements.
actually, there COULD be a need, if you want to have NULL (ie to override the default value...)

0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now