SQL Error trying to create table

Hi
In running the following SQL Script I get the error
Msg 102, Level 15, State 1, Line 74
Incorrect syntax near ')'.



IF NOT EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[MARA]') AND type in (N'U'))
BEGIN
CREATE TABLE [MARA] (
[MANDT] nvarchar(3),
[MATNR] nvarchar(18),
[ERSDA] nvarchar(8),
[ERNAM] nvarchar(12),
[LAEDA] nvarchar(8),
[AENAM] nvarchar(12),
[VPSTA] nvarchar(15),
[PSTAT] nvarchar(15),
[LVORM] nvarchar(1),
[MTART] nvarchar(4),
[MBRSH] nvarchar(1),
[MATKL] nvarchar(9),
[BISMT] nvarchar(18),
[MEINS] nvarchar(3),
[BSTME] nvarchar(3),
[ZEINR] nvarchar(22),
[ZEIAR] nvarchar(3),
[ZEIVR] nvarchar(2),
[ZEIFO] nvarchar(4),
[AESZN] nvarchar(6),
[BLATT] nvarchar(3),
[BLANZ] nvarchar(3),
[FERTH] nvarchar(18),
[FORMT] nvarchar(4),
[GROES] nvarchar(32),
[WRKST] nvarchar(48),
[NORMT] nvarchar(18),
[LABOR] nvarchar(3),
[EKWSL] nvarchar(4),
[BRGEW] decimal(18, 6),
[NTGEW] decimal(18, 6),
[GEWEI] nvarchar(3),
[VOLUM] decimal(18, 6),
[VOLEH] nvarchar(3),
[BEHVO] nvarchar(2),
[RAUBE] nvarchar(2),
[TEMPB] nvarchar(2),
[DISST] nvarchar(3),
[TRAGR] nvarchar(4),
[STOFF] nvarchar(18),
[SPART] nvarchar(2),
[KUNNR] nvarchar(10),
[EANNR] nvarchar(13),
[WESCH] decimal(18, 6),
[BWVOR] nvarchar(1),
[BWSCL] nvarchar(1),
[SAISO] nvarchar(4),
[ETIAR] nvarchar(2),
[ETIFO] nvarchar(2),
[ENTAR] nvarchar(1),
[EAN11] nvarchar(18),
[NUMTP] nvarchar(2),
[LAENG] decimal(18, 6),
[BREIT] decimal(18, 6),
[HOEHE] decimal(18, 6),
[MEABM] nvarchar(3),
[PRDHA] nvarchar(18),
[AEKLK] nvarchar(1),
[CADKZ] nvarchar(1),
[QMPUR] nvarchar(1),
[ERGEW] decimal(18, 6),
[ERGEI] nvarchar(3),
[ERVOL] decimal(18, 6),
[ERVOE] nvarchar(3),
[GEWTO] decimal(18, 6),
[VOLTO] decimal(18, 6),
[VABME] nvarchar(1),
[KZREV] nvarchar(1),
[KZKFG] nvarchar(1),
[XCHPF] nvarchar(1),
[VHART] nvarchar(4),
[FUELG] decimal(18, 6),
[STFAK] nvarchar(-1),
[MAGRV] nvarchar(4),
[BEGRU] nvarchar(4),
[DATAB] nvarchar(8),
[LIQDT] nvarchar(8),
[SAISJ] nvarchar(4),
[PLGTP] nvarchar(2),
[MLGUT] nvarchar(1),
[EXTWG] nvarchar(18),
[SATNR] nvarchar(18),
[ATTYP] nvarchar(2),
[KZKUP] nvarchar(1),
[KZNFM] nvarchar(1),
[PMATA] nvarchar(18),
[MSTAE] nvarchar(2),
[MSTAV] nvarchar(2),
[MSTDE] nvarchar(8),
[MSTDV] nvarchar(8),
[TAKLV] nvarchar(1),
[RBNRM] nvarchar(9),
[MHDRZ] decimal(18, 6),
[MHDHB] decimal(18, 6),
[MHDLP] decimal(18, 6),
[INHME] nvarchar(3),
[INHAL] decimal(18, 6),
[VPREH] decimal(18, 6),
[ETIAG] nvarchar(18),
[INHBR] decimal(18, 6),
[CMETH] nvarchar(1),
[CUOBF] nvarchar(18),
[KZUMW] nvarchar(1),
[KOSCH] nvarchar(18),
[SPROF] nvarchar(1),
[NRFHG] nvarchar(1),
[MFRPN] nvarchar(40),
[MFRNR] nvarchar(10),
[BMATN] nvarchar(18),
[MPROF] nvarchar(4),
[KZWSM] nvarchar(1),
[SAITY] nvarchar(2),
[PROFL] nvarchar(3),
[IHIVI] nvarchar(1),
[ILOOS] nvarchar(1),
[SERLV] nvarchar(1),
[KZGVH] nvarchar(1),
[XGCHP] nvarchar(1),
[KZEFF] nvarchar(1),
[COMPL] nvarchar(2),
[IPRKZ] nvarchar(1),
[RDMHD] nvarchar(1),
[PRZUS] nvarchar(1),
[MTPOS_MARA] nvarchar(4),
[BFLME] nvarchar(1),
[MATFI] nvarchar(1),
[CMREL] nvarchar(1),
[BBTYP] nvarchar(1),
[SLED_BBD] nvarchar(1),
[GTIN_VARIANT] nvarchar(2),
[GENNR] nvarchar(18),
[RMATP] nvarchar(18),
[GDS_RELEVANT] nvarchar(1),
[WEORA] nvarchar(1),
[HUTYP_DFLT] nvarchar(4),
[PILFERABLE] nvarchar(1),
[WHSTC] nvarchar(2),
[WHMATGR] nvarchar(4),
[HNDLCODE] nvarchar(4),
[HAZMAT] nvarchar(1),
[HUTYP] nvarchar(4),
[TARE_VAR] nvarchar(1),
[MAXC] decimal(18, 6),
[MAXC_TOL] decimal(18, 6),
[MAXL] decimal(18, 6),
[MAXB] decimal(18, 6),
[MAXH] decimal(18, 6),
[MAXDIM_UOM] nvarchar(3),
[HERKL] nvarchar(3),
[MFRGR] nvarchar(8),
[QQTIME] decimal(18, 6),
[QQTIMEUOM] nvarchar(3),
[QGRP] nvarchar(4),
[SERIAL] nvarchar(4),
[PS_SMARTFORM] nvarchar(30),
[LOGUNIT] nvarchar(3),
[CWQREL] nvarchar(1),
[CWQPROC] nvarchar(2),
[CWQTOLGR] nvarchar(9),
[ADPROF] nvarchar(3),
[IPMIPPRODUCT] nvarchar(40),
[ALLOW_PMAT_IGNO] nvarchar(1),
[MEDIUM] nvarchar(6),
[/BEV1/LULEINH] nvarchar(8),
[/BEV1/LULDEGRP] nvarchar(3),
[/BEV1/NESTRUCCAT] nvarchar(1),
[/DSD/SL_TOLTYP] nvarchar(4),
[/DSD/SV_CNT_GRP] nvarchar(10),
[/DSD/VC_GROUP] nvarchar(6),
[/VSO/R_TILT_IND] nvarchar(1),
[/VSO/R_STACK_IND] nvarchar(1),
[/VSO/R_BOT_IND] nvarchar(1),
[/VSO/R_TOP_IND] nvarchar(1),
[/VSO/R_STACK_NO] nvarchar(3),
[/VSO/R_PAL_IND] nvarchar(1),
[/VSO/R_PAL_OVR_D] decimal(18, 6),
[/VSO/R_PAL_OVR_W] decimal(18, 6),
[/VSO/R_PAL_B_HT] decimal(18, 6),
[/VSO/R_PAL_MIN_H] decimal(18, 6),
[/VSO/R_TOL_B_HT] decimal(18, 6),
[/VSO/R_NO_P_GVH] nvarchar(2),
[/VSO/R_QUAN_UNIT] nvarchar(3),
[/VSO/R_KZGVH_IND] nvarchar(1),
[PACKCODE] nvarchar(10),
[DG_PACK_STATUS] nvarchar(10),
[MCOND] nvarchar(1),
[RETDELC] nvarchar(1),
[LOGLEV_RETO] nvarchar(1),
[NSNID] nvarchar(9),
[IMATN] nvarchar(18),
[PICNUM] nvarchar(18),
[BSTAT] nvarchar(2),
[COLOR_ATINN] nvarchar(10),
[SIZE1_ATINN] nvarchar(10),
[SIZE2_ATINN] nvarchar(10),
[COLOR] nvarchar(18),
[SIZE1] nvarchar(18),
[SIZE2] nvarchar(18),
[FREE_CHAR] nvarchar(18),
[CARE_CODE] nvarchar(16),
[BRAND_ID] nvarchar(4),
[FIBER_CODE1] nvarchar(3),
[FIBER_PART1] nvarchar(3),
[FIBER_CODE2] nvarchar(3),
[FIBER_PART2] nvarchar(3),
[FIBER_CODE3] nvarchar(3),
[FIBER_PART3] nvarchar(3),
[FIBER_CODE4] nvarchar(3),
[FIBER_PART4] nvarchar(3),
[FIBER_CODE5] nvarchar(3),
[FIBER_PART5] nvarchar(3),
[FASHGRD] nvarchar(4),
[ZZ_SCRATCH] decimal(18, 6),
[ZZ_ABRASION] decimal(18, 6),
[ZZ_ABSORB] decimal(18, 6),
[ZZ_STAIN] decimal(18, 6),
[ZZ_RUPTURE] decimal(18, 6),
[ZZ_LENGTH] decimal(18, 6),
[ZZ_LIFNR_STORE] nvarchar(10),
[ZZ_LIFNR_SUPPL] nvarchar(10),
[ZZ_EXTMATG_A] nvarchar(18),
[ZZ_EXTMATG_B] nvarchar(18),
[ZZ_MAKTX_L] nvarchar(80)
);

Open in new window

Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAsked:
Who is Participating?
 
Jim HornMicrosoft SQL Server Developer, Architect, and AuthorCommented:
If you double-click on the error message that SSMS displays, the cursor will jump to the offending line of code, which on my 2012 box is below.  Guessing this should be nvarchar(1), as there's no such animal as a character column with a negative number of characters.

[STFAK] nvarchar(-1),

Also I see a 'begin' line up top, but no matching 'end'.
Once I corrected the STFAK line, and added an end, the code compiled.
0
 
Murray BrownMicrosoft Cloud Azure/Excel Solution DeveloperAuthor Commented:
Great trick. I had no idea you could do that. Much appreciated
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.