Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7846613
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 2, 20262026-06-02T17:38:27+00:00 2026-06-02T17:38:27+00:00

I can’t run this SQL script. This errors occurs: Message 102, Level 15, State

  • 0

I can’t run this SQL script.

This errors occurs:

Message 102, Level 15, State 1, Line 10
Incorrect syntax near the construction “=”.
Message 102, Level 15, State 1, Line 28
Incorrect syntax near the construction of “".
Message 102, Level 15, State 1, Line 56
Incorrect syntax near the construction of "
“.
Message 102, Level 15, State 1, Line 86
Incorrect syntax near the construction of “` “.

What can I do?

-- phpMyAdmin SQL Dump
-- version 3.3.1
-- http://www.phpmyadmin.net
--
-- Хост: localhost
-- Время создания: Дек 29 2011 г., 16:23
-- Версия сервера: 5.5.10
-- Версия PHP: 5.2.4

SET SQL_MODE="NO_AUTO_VALUE_ON_ZERO";


/*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
/*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
/*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
/*!40101 SET NAMES utf8 */;

--
-- База данных: `test`
--

-- --------------------------------------------------------

--
-- Структура таблицы `customers`
--

CREATE TABLE IF NOT EXISTS `customers` (
  `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'идентификатор записи',
  `FIRST_NAME` varchar(30) COLLATE utf8_bin NOT NULL COMMENT 'Имя',
  `LAST_NAME` varchar(30) COLLATE utf8_bin NOT NULL COMMENT 'Фамилия',
  `PHONE` varchar(10) COLLATE utf8_bin NOT NULL COMMENT 'Телефон',
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='заказчики' AUTO_INCREMENT=9 ;

--
-- Дамп данных таблицы `customers`
--

INSERT INTO `customers` (`ID`, `FIRST_NAME`, `LAST_NAME`, `PHONE`) VALUES
(1, 'Борис', 'Петров', ''),
(2, 'Иван', 'Сидоров', ''),
(3, 'Сергей', 'Иванов', ''),
(4, 'Александр', 'Бойко', ''),
(5, 'Петр', 'Борисов', ''),
(6, 'Семён', 'Александров', ''),
(7, 'Александр', 'Лебедев', ''),
(8, 'Алексей', 'Ильин', '');

-- --------------------------------------------------------

--
-- Структура таблицы `items`
--

CREATE TABLE IF NOT EXISTS `items` (
  `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'идентификатор записи',
  `NAME` varchar(50) COLLATE utf8_bin NOT NULL COMMENT 'название товара',
  `AMOUNT` float NOT NULL DEFAULT '0' COMMENT 'цена товара',
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin AUTO_INCREMENT=12 ;

--
-- Дамп данных таблицы `items`
--

INSERT INTO `items` (`ID`, `NAME`, `AMOUNT`) VALUES
(1, 'Молоток', 0),
(2, 'Бумага', 0),
(3, 'Шоколадка Snickers', 0),
(4, 'Отвёртка', 0),
(5, 'Ручка', 0),
(6, 'Шоколадка Kit-Kat', 0),
(7, 'Гаечный ключ', 0),
(8, 'Карандаш', 0),
(9, 'Конфеты Helth Bar', 0),
(10, 'Счётчик ленты', 0),
(11, 'Переплётная машина', 0);

-- --------------------------------------------------------

--
-- Структура таблицы `payments`
--

CREATE TABLE IF NOT EXISTS `payments` (
  `ID` int(11) NOT NULL AUTO_INCREMENT COMMENT 'идентификатор записи',
  `CUSTOMER_ID` int(11) NOT NULL COMMENT 'ИД заказчика. Связь с таблицей customers',
  `ITEM_ID` int(11) NOT NULL COMMENT 'ИД товара. Связь с таблицей items',
  `ITEM_COUNT` int(11) NOT NULL DEFAULT '0' COMMENT 'количество товара',
  `TRANS_TIME` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP COMMENT 'время транзакции',
  PRIMARY KEY (`ID`)
) ENGINE=MyISAM  DEFAULT CHARSET=utf8 COLLATE=utf8_bin COMMENT='продажи' AUTO_INCREMENT=21 ;

--
-- Дамп данных таблицы `payments`
--

INSERT INTO `payments` (`ID`, `CUSTOMER_ID`, `ITEM_ID`, `ITEM_COUNT`, `TRANS_TIME`) VALUES
(1, 1, 6, 0, '2011-12-29 14:49:06'),
(2, 1, 9, 0, '2011-12-29 14:49:06'),
(3, 2, 2, 0, '2011-12-29 14:52:09'),
(4, 2, 8, 0, '2011-12-29 14:52:09'),
(5, 3, 4, 0, '2011-12-29 14:52:09'),
(6, 3, 7, 0, '2011-12-29 14:52:09'),
(7, 3, 10, 0, '2011-12-29 14:52:09'),
(8, 4, 5, 0, '2011-12-29 14:52:09'),
(9, 4, 8, 0, '2011-12-29 14:52:09'),
(10, 4, 11, 0, '2011-12-29 14:52:09'),
(11, 5, 1, 0, '2011-12-29 14:52:09'),
(12, 5, 4, 0, '2011-12-29 14:52:09'),
(13, 5, 10, 0, '2011-12-29 14:52:35'),
(14, 6, 5, 0, '2011-12-29 14:52:35'),
(15, 6, 11, 0, '2011-12-29 14:52:55'),
(16, 7, 1, 0, '2011-12-29 14:52:55'),
(17, 7, 4, 0, '2011-12-29 14:53:12'),
(18, 8, 3, 0, '2011-12-29 14:53:12'),
(19, 8, 9, 0, '2011-12-29 14:53:22'),
(20, 2, 11, 0, '2011-12-29 16:03:55');
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-02T17:38:30+00:00Added an answer on June 2, 2026 at 5:38 pm

    You’re trying to run a MySQL script on a SQL Server database. You will need to make many changes before that works. Try this (I have ported your code to TSQL):

    CREATE PROCEDURE #AddDescription
        (@table sysname, @column sysname, @description sysname)
    AS
        DECLARE @level2type sysname;
    
        IF @column COLLATE database_default IS NOT NULL
            SET @level2type = 'COLUMN'
    
        EXEC sys.sp_addextendedproperty
            'MS_Description', @description,
            'SCHEMA', 'dbo',
            'TABLE', @table,
            @level2type, @column
    GO
    
    IF 'customers' NOT IN (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'dbo')
    BEGIN
        CREATE TABLE [customers]
        (
            [ID] int NOT NULL IDENTITY(9,1),
            [FIRST_NAME] nvarchar(30) NOT NULL,
            [LAST_NAME] nvarchar(30) NOT NULL,
            [PHONE] nvarchar(10) NOT NULL,
            PRIMARY KEY ([ID])
        )
    
        EXEC #AddDescription 'customers', NULL, N'заказчики'
        EXEC #AddDescription 'customers', 'ID', N'идентификатор записи'
        EXEC #AddDescription 'customers', 'FIRST_NAME', N'Имя'
        EXEC #AddDescription 'customers', 'LAST_NAME', N'Фамилия'
        EXEC #AddDescription 'customers', 'PHONE', N'Телефон'
    END
    
    SET IDENTITY_INSERT [customers] ON
    
    INSERT INTO [customers] ([ID], [FIRST_NAME], [LAST_NAME], [PHONE]) SELECT
    1, N'Борис', N'Петров', '' UNION ALL SELECT
    2, N'Иван', N'Сидоров', '' UNION ALL SELECT
    3, N'Сергей', N'Иванов', '' UNION ALL SELECT
    4, N'Александр', N'Бойко', '' UNION ALL SELECT
    5, N'Петр', N'Борисов', '' UNION ALL SELECT
    6, N'Семён', N'Александров', '' UNION ALL SELECT
    7, N'Александр', N'Лебедев', '' UNION ALL SELECT
    8, N'Алексей', N'Ильин', '';
    
    SET IDENTITY_INSERT [customers] OFF
    
    DBCC CHECKIDENT('[customers]', RESEED) WITH NO_INFOMSGS 
    
    IF 'items' NOT IN (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'dbo')
    BEGIN
        CREATE TABLE [items]
        (
            [ID] int NOT NULL IDENTITY(12,1),
            [NAME] nvarchar(50) NOT NULL,
            [AMOUNT] float NOT NULL DEFAULT '0',
            PRIMARY KEY ([ID])
        )
    
        EXEC #AddDescription 'items', 'ID', N'идентификатор записи'
        EXEC #AddDescription 'items', 'NAME', N'название товара'
        EXEC #AddDescription 'items', 'AMOUNT', N'цена товара'
    END
    
    SET IDENTITY_INSERT [items] ON
    
    INSERT INTO [items] ([ID], [NAME], [AMOUNT]) SELECT
    1, N'Молоток', 0 UNION ALL SELECT
    2, N'Бумага', 0 UNION ALL SELECT
    3, N'Шоколадка Snickers', 0 UNION ALL SELECT
    4, N'Отвёртка', 0 UNION ALL SELECT
    5, N'Ручка', 0 UNION ALL SELECT
    6, N'Шоколадка Kit-Kat', 0 UNION ALL SELECT
    7, N'Гаечный ключ', 0 UNION ALL SELECT
    8, N'Карандаш', 0 UNION ALL SELECT
    9, N'Конфеты Helth Bar', 0 UNION ALL SELECT
    10, N'Счётчик ленты', 0 UNION ALL SELECT
    11, N'Переплётная машина', 0;
    
    SET IDENTITY_INSERT [items] OFF
    
    DBCC CHECKIDENT('items', RESEED) WITH NO_INFOMSGS 
    
    IF 'payments' NOT IN (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
        WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = 'dbo')
    BEGIN
        CREATE TABLE [payments]
        (
            [ID] int NOT NULL IDENTITY(21,1),
            [CUSTOMER_ID] int NOT NULL,
            [ITEM_ID] int NOT NULL ,
            [ITEM_COUNT] int NOT NULL DEFAULT '0',
            [TRANS_TIME] datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
            PRIMARY KEY ([ID])
        )
    
        EXEC #AddDescription 'payments', NULL, N'продажи' 
        EXEC #AddDescription 'payments', 'ID', N'идентификатор записи'
        EXEC #AddDescription
            'payments', 'CUSTOMER_ID', N'ИД заказчика. Связь с таблицей customers'
        EXEC #AddDescription
            'payments', 'ITEM_ID', N'ИД товара. Связь с таблицей items'
        EXEC #AddDescription 'payments', 'ITEM_COUNT', N'количество товар'
        EXEC #AddDescription 'payments', 'TRANS_TIME', N'время транзакции'
    END
    
    SET IDENTITY_INSERT [payments] ON
    
    INSERT INTO [payments]
    ([ID], [CUSTOMER_ID], [ITEM_ID], [ITEM_COUNT], [TRANS_TIME]) SELECT
    1, 1, 6, 0, '2011-12-29T14:49:06' UNION ALL SELECT
    2, 1, 9, 0, '2011-12-29T14:49:06' UNION ALL SELECT
    3, 2, 2, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    4, 2, 8, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    5, 3, 4, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    6, 3, 7, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    7, 3, 10, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    8, 4, 5, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    9, 4, 8, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    10, 4, 11, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    11, 5, 1, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    12, 5, 4, 0, '2011-12-29T14:52:09' UNION ALL SELECT
    13, 5, 10, 0, '2011-12-29T14:52:35' UNION ALL SELECT
    14, 6, 5, 0, '2011-12-29T14:52:35' UNION ALL SELECT
    15, 6, 11, 0, '2011-12-29T14:52:55' UNION ALL SELECT
    16, 7, 1, 0, '2011-12-29T14:52:55' UNION ALL SELECT
    17, 7, 4, 0, '2011-12-29T14:53:12' UNION ALL SELECT
    18, 8, 3, 0, '2011-12-29T14:53:12' UNION ALL SELECT
    19, 8, 9, 0, '2011-12-29T14:53:22' UNION ALL SELECT
    20, 2, 11, 0, '2011-12-29T16:03:55'
    
    SET IDENTITY_INSERT [payments] OFF
    
    DBCC CHECKIDENT('payments', RESEED) WITH NO_INFOMSGS 
    
    DROP PROCEDURE #AddDescription
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Can I run this in a Windows command prompt like I can run it
can I make my own headers in HTTP request ? e.g. This is normal
Can this be done? It seems like this should be possible. In general, I
Can somebody help me with this. There is HTML code: <h3> <label> <input type=checkbox
Can anybody help me? What should be the datatype for this type -07:00:00 of
can someone explain why the compiler accepts only this code template<typename L, size_t offset,
Can't figure out how to do this in a pretty way : I have
Can a LINQ enabled app run on a machine that only has the .NET
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
can anyone tell me why this doesn't work? db = openOrCreateDatabase(database.db, SQLiteDatabase.CREATE_IF_NECESSARY, null); db.setLocale(Locale.getDefault());

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.