Добро пожаловать в форум, Guest  >>   Войти | Регистрация | Поиск | Правила | В избранное | Подписаться
Все форумы / Microsoft SQL Server Новый топик    Ответить
 сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
Добрый день! Помогите пожалуйста с датами: необходимо сделать выборки за равные интервалы,
например выборку между датами ('число,месяц 2011' и 'число1,месяц1 .2011') сравнить с выборкой между ('число,месяц.2012' и 'число1,месяц1 .2012'), причем год хотелось бы представлять в виде параметра. + (пока писал понял, что еще необходима проверка на високосный год). Мне кажется, это не совсем просто сделать.
9 фев 12, 14:45    [12062663]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
Glory
Member

Откуда:
Сообщений: 104751
https://www.sql.ru/forum/actualthread.aspx?tid=127456 п.4. и п.6
9 фев 12, 14:46    [12062686]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
Microsoft SQL Server 2008 (RTM) - 10.0.1600.22 (Intel X86) Jul 9 2008 14:43:34 Copyright (c) 1988-2008 Microsoft Corporation Standard Edition on Windows NT 5.2 <X86> (Build 3790: Service Pack 2)
кода ошибки нет, потому что не придумал как это сделать
9 фев 12, 14:52    [12062767]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
Glory
Member

Откуда:
Сообщений: 104751
nickolay_fff
кода ошибки нет, потому что не придумал как это сделать

Структуры таблиц и данных в них тоже нет
Потому что тоже не придумал, сколько и каких таблиц будет, и что за данные туда будут занесены

Так же не придумал критерии сравнения наборов, толи число записей сранивать, толи содержимое всех полей, то ли выборочных полей
Ну вообщем ничего еще не придумал, кроме вопроса, как это сделать
9 фев 12, 14:56    [12062817]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
Таблица 1 с наполнением:

USE [el_dnevn]
GO

SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[Napr_Work_Sprav](
	[id_Napr_Work_Sprav] [int] IDENTITY(1,1) NOT NULL,
	[Napr_Work_Sprav] [char](50) NULL,
PRIMARY KEY CLUSTERED 
(
	[id_Napr_Work_Sprav] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, 
IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) 
  ON [PRIMARY]
) ON [PRIMARY]

GO

SET ANSI_PADDING OFF
GO
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('психолого-педагогическое')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('продвижение чтения')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('экологическое')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('краеведческое')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('эстетическое')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('патриотическое')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('здоровьесбережение')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('социально-значимая,правовая информация')
INSERT INTO Napr_Work_Spra (Napr_Work_Spra) VALUES ('новинки')

Таблица 2 с наполнением:

USE [el_dnevn]
GO
/****** Object:  Table [dbo].[PblWork]    Script Date: 02/03/2012 12:32:36 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[PblWork](
	[id_mer] [int] IDENTITY(1,1) NOT NULL,
	[PlaceIdent] [int] NULL,
	[Date_Start] [datetime] NULL,
	[Date_Stop] [datetime] NULL,
	[STime] [datetime] NULL,
	[Name] [nvarchar](50) NULL,
	[Forma_Rab] [int] NULL,
	[Napr_Rab] [int] NULL,
	[Posesh] [int] NULL,
	[Knigi] [int] NULL,
	[tip_mer] [int] NULL,
	[Tvorch] [int] NULL,
	[Zakazchik] [int] NULL,
	[uchet] [bit] NULL,
PRIMARY KEY CLUSTERED 
(
	[id_mer] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO

SET IDENTITY_INSERT [dbo].[PblWork] ON
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (1, 3022, CAST(0x00009CF400000000 AS DateTime), CAST(0x00009D0F00000000 AS DateTime), NULL, N'Игры на морозе', 1, 7, 93, 74, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (2, 3022, CAST(0x00009CF400000000 AS DateTime), CAST(0x00009D0F00000000 AS DateTime), NULL, N'Новинки', 1, 10, 627, 631, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (3, 3022, CAST(0x00009CF400000000 AS DateTime), CAST(0x00009D0F00000000 AS DateTime), NULL, N'Зимняя сказка', 1, 2, 145, 170, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (4, 3022, CAST(0x00009CF400000000 AS DateTime), CAST(0x00009D0F00000000 AS DateTime), NULL, N'Великий датский сказочник', 1, 2, 43, 35, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (5, 3022, CAST(0x00009CF400000000 AS DateTime), CAST(0x00009D0F00000000 AS DateTime), NULL, N'Чемпионы читательских симпатий', 1, 2, 147, 144, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (6, 3022, CAST(0x00009CF400000000 AS DateTime), CAST(0x00009D0F00000000 AS DateTime), NULL, N'Русский язык: прошлое, настоящее, будущее', 1, 2, 98, 100, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (7, 3022, CAST(0x00009CF400000000 AS DateTime), CAST(0x00009D0F00000000 AS DateTime), NULL, N'Говорящие книги: проведи время с пользой', 1, 5, 156, 34, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (8, 3022, CAST(0x00009CF400000000 AS DateTime), NULL, CAST(0x0000000000E6B680 AS DateTime), N'Сумасшедшие гонки', 5, 5, 3, 5, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (9, 3022, CAST(0x00009CFC00000000 AS DateTime), NULL, CAST(0x0000000000B54640 AS DateTime), N'Ёлка', 5, 5, 15, 8, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (10, 3022, CAST(0x00009CFC00000000 AS DateTime), NULL, CAST(0x0000000000C5C100 AS DateTime), N'Новогодняя сказка', 4, 2, 18, 2, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (11, 3022, CAST(0x00009CFC00000000 AS DateTime), NULL, CAST(0x0000000000E6B680 AS DateTime), N'Новогодние конкурсы со Снегурочкой и Бабой-Ягой', 4, 5, 20, NULL, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (12, 3022, CAST(0x00009CFD00000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Ночь перед Рождеством', 5, 5, 12, 7, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (13, 3022, CAST(0x00009CFD00000000 AS DateTime), NULL, CAST(0x0000000000C5C100 AS DateTime), N'Новогодняя сказка', 4, 2, 26, 13, 1, NULL, 55, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (14, 3022, CAST(0x00009CFD00000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'В новый год с новыми книгами', 4, 2, 10, 30, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (15, 3022, CAST(0x00009CFE00000000 AS DateTime), NULL, CAST(0x0000000000B54640 AS DateTime), N'Новогодняя сказка', 4, 2, 19, 25, 2, NULL, 42, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (16, 3022, CAST(0x00009CFF00000000 AS DateTime), NULL, CAST(0x0000000000C5C100 AS DateTime), N'Подарок Деда Мороза', 4, 2, 7, 8, 1, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (17, 3022, CAST(0x00009D0B00000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Ночь перед Рождеством', 5, 5, 4, 5, 1, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (18, 3022, CAST(0x00009D0B00000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'В стране героев Г.Х. Андерсена', 2, 2, 10, 8, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (19, 3022, CAST(0x00009D0B00000000 AS DateTime), NULL, CAST(0x0000000000B54640 AS DateTime), N'Книжное царство-мудрое государство', 8, 2, 16, 25, 3, NULL, 48, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (20, 3022, CAST(0x00009D0C00000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'Ох, уж эти детки!', 5, 5, 6, 3, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (21, 3022, CAST(0x00009D0D00000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'Губка Боб Квадратные штаны', 5, 5, 10, 3, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (22, 3022, CAST(0x00009D0D00000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Мадагаскар', 5, 5, 10, 4, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (23, 3022, CAST(0x00009D0D00000000 AS DateTime), NULL, CAST(0x0000000000C5C100 AS DateTime), N'Волшебная сметана', 4, 2, 10, 10, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (24, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Хобби настоящих мужчин', 1, 7, 61, 42, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (25, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Новинки', 1, 10, 449, 536, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (26, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Гражданин Тобольска', 1, 2, 54, 44, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (27, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Литературные однофамильцы', 1, 2, 97, 80, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (28, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Некогда читать? Слушай фэнтези!', 1, 2, 80, 13, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (29, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Чудеса в миниатюре', 1, 2, 38, NULL, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (30, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Педагогические бестселлеры', 1, 1, 108, 122, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (31, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Школа безопасности', 1, 8, 157, 100, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (32, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Что нас окружает', 1, 3, 122, 100, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (33, 3022, CAST(0x00009D1000000000 AS DateTime), CAST(0x00009D2B00000000 AS DateTime), NULL, N'Литературная страна', 4, 2, 14, 24, 4, 14, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (34, 3022, CAST(0x00009D1200000000 AS DateTime), NULL, CAST(0x00000000011826C0 AS DateTime), N'Алеша Попович и Тугарин Змей', 5, 5, 11, 5, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (35, 3022, CAST(0x00009D1300000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Вольт', 5, 5, 9, 7, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (36, 3022, CAST(0x00009D1300000000 AS DateTime), NULL, NULL, N'Книжное царство-мудрое государство', 8, 2, 13, 20, 1, NULL, 50, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (37, 3022, CAST(0x00009D1400000000 AS DateTime), NULL, NULL, N'Волшебная сметана', 4, 2, 13, 14, 1, NULL, 50, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (38, 3022, CAST(0x00009D1B00000000 AS DateTime), NULL, NULL, N'Зайкина тетя', 4, 2, 30, 8, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (39, 3022, CAST(0x00009D1B00000000 AS DateTime), NULL, NULL, N'Гражданин Тобольска', 6, 2, 8, 14, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (40, 3022, CAST(0x00009D1B00000000 AS DateTime), NULL, NULL, N'В стране героев Х. К. Андерсена', 6, 2, 10, 8, 1, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (41, 3022, CAST(0x00009D1D00000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'Вольт', 5, 5, 9, 6, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (42, 3022, CAST(0x00009D1F00000000 AS DateTime), NULL, NULL, N'Гражданин Тобольска', 6, 2, 4, 7, 1, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (43, 3022, CAST(0x00009D2400000000 AS DateTime), NULL, NULL, N'Гражданин Тобольска', 6, 2, 8, 14, 1, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (44, 3022, CAST(0x00009D2700000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Путешествие Гулливера', 5, 5, 8, 4, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (45, 3022, CAST(0x00009D2800000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'Сын Маски', 5, 5, 8, 5, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (46, 3022, CAST(0x00009D2900000000 AS DateTime), NULL, NULL, N'Любочкины помощники', 4, 2, 20, 20, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (47, 3022, CAST(0x00009D2900000000 AS DateTime), NULL, NULL, N'Любочкины помощники', 4, 2, 20, 20, 1, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (48, 3022, CAST(0x00009D2B00000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Сын Маски', 5, 5, 7, 4, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (49, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Новинки', 1, 10, 405, 409, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (50, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Хочу стать великим', 1, 2, 99, 83, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (51, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Чудеса в миниатюре', 1, 2, 121, NULL, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (52, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Школа безопасности', 1, 8, 62, 15, 3, NULL, 12, 1)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (53, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'В согласии с природой', 1, 3, 77, 51, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (54, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Жалобная книга природы', 1, 3, 136, 123, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (55, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Лики живой природы', 1, 3, 87, 30, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (56, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Животные-рекордсмены', 1, 3, 48, 53, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (57, 3022, CAST(0x00009D2C00000000 AS DateTime), CAST(0x00009D4900000000 AS DateTime), NULL, N'Лесные жители', 1, 3, 59, 101, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (58, 3022, CAST(0x00009D3000000000 AS DateTime), NULL, NULL, N'Животные-рекордсмены', 6, 3, 7, 6, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (59, 3022, CAST(0x00009D3600000000 AS DateTime), NULL, NULL, N'Обзор для сотрудников ДОУ', 6, 1, 35, 10, 4, NULL, 54, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (60, 3022, CAST(0x00009D3600000000 AS DateTime), NULL, NULL, N'Обзор для сотрудников ДОУ', 6, 1, 36, 15, 4, NULL, 54, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (61, 3022, CAST(0x00009D3700000000 AS DateTime), NULL, NULL, N'Капризка', 4, 2, 15, 25, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (62, 3022, CAST(0x00009D3A00000000 AS DateTime), NULL, NULL, N'В согласии с природой', 6, 3, 13, 6, 3, NULL, 46, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (63, 3022, CAST(0x00009D3A00000000 AS DateTime), NULL, NULL, N'Книжное царство-мудрое государство', 8, 2, 12, 15, 1, NULL, 26, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (64, 3022, CAST(0x00009D3B00000000 AS DateTime), NULL, CAST(0x0000000000FF6EA0 AS DateTime), N'Губка Боб Квадратные штаны', 5, 5, 10, 4, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (65, 3022, CAST(0x00009D3B00000000 AS DateTime), NULL, NULL, N'Животные-рекордсмены', 6, 3, 14, 18, 1, NULL, 51, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (66, 3022, CAST(0x00009D3B00000000 AS DateTime), NULL, NULL, N'Книжное царство-мудрое государство', 8, 2, 14, 17, 1, NULL, 51, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (67, 3022, CAST(0x00009D3C00000000 AS DateTime), NULL, NULL, N'Голубая планета', 5, 3, 7, 6, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (68, 3022, CAST(0x00009D3C00000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Сумасшедшие гонки', 5, 5, 7, 6, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (69, 3022, CAST(0x00009D4000000000 AS DateTime), NULL, CAST(0x000000000107AC00 AS DateTime), N'Вольт', 5, 5, 11, 8, 4, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (70, 3022, CAST(0x00009D4300000000 AS DateTime), NULL, CAST(0x0000000000CDFE60 AS DateTime), N'Ребятам о зверятах', 5, 3, 15, 10, 3, NULL, 65, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (71, 3022, CAST(0x00009D4300000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'Ребятам о зверятах', 5, 3, 30, 14, 1, NULL, 43, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (72, 3022, CAST(0x00009D4300000000 AS DateTime), NULL, NULL, N'У природы нет плохой погоды', 4, 3, 16, 6, 3, NULL, 60, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (73, 3022, CAST(0x00009D4300000000 AS DateTime), NULL, NULL, N'Берегите землю, берегите!', 2, 3, 27, 10, 3, NULL, 35, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (74, 3022, CAST(0x00009D4400000000 AS DateTime), NULL, NULL, N'Океан глазами детей', 4, 3, 9, 10, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (75, 3022, CAST(0x00009D4400000000 AS DateTime), NULL, CAST(0x0000000000B54640 AS DateTime), N'Призвание природу защищать', 2, 3, 15, 7, 3, NULL, 64, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (76, 3022, CAST(0x00009D4400000000 AS DateTime), NULL, CAST(0x0000000000D63BC0 AS DateTime), N'Призвание природу защищать', 2, 3, 7, 5, 1, NULL, 60, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (77, 3022, CAST(0x00009D4500000000 AS DateTime), NULL, CAST(0x0000000000F73140 AS DateTime), N'География для малышей', 5, 3, 20, 18, 3, NULL, 43, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (78, 3022, CAST(0x00009D4500000000 AS DateTime), NULL, NULL, N'Кот, лиса и петух', 4, 2, 21, 21, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (79, 3022, CAST(0x00009D4500000000 AS DateTime), NULL, NULL, N'Кот, лиса и петух', 4, 2, 18, 14, 1, NULL, 52, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (80, 3022, CAST(0x00009D4500000000 AS DateTime), NULL, NULL, N'Океан глазами детей', 4, 3, 13, 17, 1, NULL, 43, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (81, 3022, CAST(0x00009D4500000000 AS DateTime), NULL, NULL, N'Экология здоровья и уюта', 2, 3, 9, 14, 1, NULL, 46, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (82, 3022, CAST(0x00009D4700000000 AS DateTime), NULL, NULL, N'Церемония награждения победителей фотоконкурса "До', 4, 3, 27, 21, 3, 366, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (83, 3022, CAST(0x00009D4800000000 AS DateTime), NULL, CAST(0x0000000000C5C100 AS DateTime), N'Голубая планета', 5, 3, 18, 10, 3, NULL, 43, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (84, 3022, CAST(0x00009D4800000000 AS DateTime), NULL, NULL, N'Океан глазами детей', 4, 3, 23, 20, 1, NULL, 43, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (85, 3022, CAST(0x00009D4900000000 AS DateTime), NULL, NULL, N'Югорский лес-край чудес', 2, 3, 46, 20, 3, NULL, 43, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (86, 3022, CAST(0x00009D4B00000000 AS DateTime), CAST(0x00009D6700000000 AS DateTime), NULL, N'Новинки', 1, 10, 591, 543, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (87, 3022, CAST(0x00009D4B00000000 AS DateTime), CAST(0x00009D6700000000 AS DateTime), NULL, N'Найди профессию по душе', 1, 8, 49, 53, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (88, 3022, CAST(0x00009D4B00000000 AS DateTime), CAST(0x00009D6700000000 AS DateTime), NULL, N'Марк Твен и его герои', 1, 2, 92, 50, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (89, 3022, CAST(0x00009D4B00000000 AS DateTime), CAST(0x00009D6700000000 AS DateTime), NULL, N'Покорители космоса', 1, 2, 170, 171, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (90, 3022, CAST(0x00009D4B00000000 AS DateTime), CAST(0x00009D6700000000 AS DateTime), NULL, N'Береги здоровье смолоду', 1, 7, 58, 66, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (91, 3022, CAST(0x00009D4B00000000 AS DateTime), CAST(0x00009D6700000000 AS DateTime), NULL, N'Сказочный ларец', 1, 2, 73, 19, 3, NULL, 12, 0)
INSERT [dbo].[PblWork] ([id_mer], [PlaceIdent], [Date_Start], [Date_Stop], [STime], [Name], [Forma_Rab], [Napr_Rab], [Posesh], [Knigi], [tip_mer], [Tvorch], [Zakazchik], [uchet]) VALUES (92, 3022, CAST(0x00009D6400000000 AS DateTime), CAST(0x00009D6700000000 AS DateTime), NULL, N'Сургутяне в годы войны', 1, 6, 100, 35, 3, NULL, 12, 0)

GO


Скрипт:


declare @KOLVO varchar(max)
declare @DS int
declare @DST int
set @DS='2012'
set @DST='201'

set @KOLVO = 
	(select  '['+cast(yr as varchar)+'-'+cast('Количество'  as varchar)+'],' as 'data()' 
		from (SELECT DISTINCT YEAR(DATE_START) AS YR
	    from [dbo].[PblWork]  WHERE YEAR(DATE_START) IN (@DST,@DS) 
	    ) a 
	    order by  '['+cast(yr as varchar)+'-'+cast('Количество'  as varchar)+'],'
		for xml path(''))
		
		set @KOLVO = left(@KOLVO, len(@KOLVO)-1)
		PRINT  @KOLVO

declare @STKOLVO varchar(max)

SET @STKOLVO='select Napr_Work_Sprav,'+@KOLVO+' from
(select (case when c.uchet=0 then napr_rab end) as cx, cast(year(date_start) as varchar)+''-''+cast(''Количество'' as varchar) as xz, Napr_Work_Sprav
from [dbo].[PblWork] c inner join Napr_Work_Sprav b on b.id_Napr_Work_Sprav=c.Napr_Rab
where c.placeident='3022' and  c.Date_Start 'суть задачи'   and  c.forma_rab=1) a
pivot (count(cx) for xz in('+@KOLVO+')) pw'
9 фев 12, 15:13    [12063016]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
В начала еще у меня:
Declare @Date_start datetime
Declare @Date_stop datetime
set @Date_start= '01.02.2012'
set @Date_stop='29.02.2012'


суть задачи сравнить показатели за интервалы между @Date_start и @Date_stop (год 2012) и такими же @Date_start и @Date_stop (год 2011) + чтобы не получилось 29.02.2011 (тот год был не високосный). + пара лет (2011,2012 ) задается параметром
9 фев 12, 15:19    [12063087]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
Glory
Member

Откуда:
Сообщений: 104751
nickolay_fff
суть задачи сравнить показатели за интервалы

И как их сравнить то ?
9 фев 12, 15:23    [12063129]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
направления работы 2010-количество 2012-количество
здоровьесбережение 22 15
новинки 24 11
............. ... ...

то есть раскидать по столбцам
9 фев 12, 15:31    [12063216]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
Andraptor
Member

Откуда: Ukraine, Kharkiv
Сообщений: 291
мне кажется Вам нужно почитать в BOL про функцию
datediff
9 фев 12, 15:32    [12063234]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
Почитал. Все равно не знаю, как отделить от любой даты год и приклеить к ней свой, к примеру
9 фев 12, 16:30    [12063991]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
iljy
Member

Откуда:
Сообщений: 8711
nickolay_fff
Почитал. Все равно не знаю, как отделить от любой даты год и приклеить к ней свой, к примеру

Declare @db1 datetime, @db2 datetime
Declare @de1 datetime, @de2 datetime
declare @Year2 int
select @db1 = '20120201',@de1 = '20120229', @Year2 = 2010

select @db2 = DATEADD(yy, d, @db1), @de2 = DATEADD(yy, d, @de1)
from (select (@Year2-1900) - DATEDIFF(yy, 0, @db1) d)t

select @db2, @de2
9 фев 12, 16:46    [12064216]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
К сожалению, никак не могу понять форматов дат и всяческого конвертирования. Не получается.
9 фев 12, 19:23    [12065471]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
iljy
Member

Откуда:
Сообщений: 8711
nickolay_fff,

откройте документацию и прочитайте. Если будут конкретные вопросы - вернетесь и зададите.
9 фев 12, 19:27    [12065496]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
Select Текст запроса... from [Таблица] where [Таблица.Дата] between ([@Date_start(введенная дата вида '01.02.2012')] and [@Date_stop введенная дата вида '29.02.2012'] and between([@Date_start(год задан параметром)] and [@Date_stop (год задан параметром)])
конкретный вопрос:
как правильно вписать
SET @STKOLVO='select Napr_Work_Sprav,'+@KOLVO+' from
(select (case when c.uchet=0 then napr_rab end) as cx, cast(year(date_start) as varchar)+''-''+cast(''Количество'' as varchar) as xz, Napr_Work_Sprav
from [dbo].[PblWork] c inner join Napr_Work_Sprav b on b.id_Napr_Work_Sprav=c.Napr_Rab
where c.placeident='3022' and  c.Date_Start 'between ([@Date_start(введенная дата вида '01.02.2012')] 
and [@Date_stop введенная дата вида '29.02.2012'] and between([@Date_start(год задан параметром)] 
and [@Date_stop (год задан параметром)])'   and  c.forma_rab=1) a
pivot (count(cx) for xz in('+@KOLVO+')) pw'

чтобы работало. Все почитал, хелп, BOL, форум SQL Server, а до этого форум по Access доставал с форматами дат.
9 фев 12, 19:47    [12065610]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
iljy
Member

Откуда:
Сообщений: 8711
nickolay_fff,

чтоб присваивание работало? Надо внутри строки одинарные апострофы удвоить, это написано в документации в главе "Символьные константы"
9 фев 12, 19:53    [12065636]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
это я знаю. дело не в апострофах, я просто так выделил то, что мне нужно
9 фев 12, 20:24    [12065842]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
iljy
Member

Откуда:
Сообщений: 8711
nickolay_fff
это я знаю. дело не в апострофах, я просто так выделил то, что мне нужно

Вы привели некий оператор присваивания, синтаксически некорректный. Какое он имеет отношение к сравнению интервалов времени - не понятно.
До этого вы спрашивали, как заменить в датах год на нужный, на этот вопрос я вам ответил.
9 фев 12, 20:38    [12065900]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
iljy, спасибо за
Declare @db1 datetime, @db2 datetime
Declare @de1 datetime, @de2 datetime
declare @Year2 int
select @db1 = '20120201',@de1 = '20120229', @Year2 = 2010

select @db2 = DATEADD(yy, d, @db1), @de2 = DATEADD(yy, d, @de1)
from (select (@Year2-1900) - DATEDIFF(yy, 0, @db1) d)t

select @db2, @de2

я попытался создать функцию
USE [el_dnevn]
GO
/****** Object:  UserDefinedFunction [dbo].[ReturnDatePeriod]    Script Date: 02/09/2012 22:44:27 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER FUNCTION [dbo].[ReturnDatePeriod](@Date datetime,@SetYear int) 
RETURNS varchar

AS 
BEGIN 

	declare @RetDate varchar(10) --чтоб не конвертировать потом
		select @Date = DATEADD(yy, d, @Date)
from (select (@SetYear-1900) - DATEDIFF(yy, 0, @Date) d)t

set @RetDate=convert(varchar,@Date,104)
return @RetDate

END

Вызываю:
declare @aa datetime
declare @bb int
declare @result varchar
set @aa='01.02.2012'
set @bb='2011'
set @result= dbo.ReturnDatePeriod(@aa,@bb)
select @result

выводит 0
В чем ошибка?
9 фев 12, 21:02    [12065991]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
iljy
Member

Откуда:
Сообщений: 8711
nickolay_fff
iвыводит 0
В чем ошибка?


varchar == varchar(1)

И еще: никогда не используйте для задания констант даты языковозависимый формат. Ваше '01.02.2012' может оказаться 1 февраля, а может 2 января, в зависимости от настроек сервера. Гораздо проще и спокойнее всегда писать '20120201', этот формат всегда интерпретируется одинаково. Либо можно использовать формат ISO8601: гггг-мм-ддTчч:мм:сс.ммм.
9 фев 12, 21:20    [12066051]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
iljy
Member

Откуда:
Сообщений: 8711
nickolay_fff,

чтоб не быть голословным:
set language russian

declare @date datetime set @date = '02.01.2012'
select cast(@date as varchar)

set language english

set @date = '02.01.2012'
select cast(@date as varchar)
9 фев 12, 21:23    [12066055]     Ответить | Цитировать Сообщить модератору
 Re: сравнить интервалы времени  [new]
nickolay_fff
Member

Откуда:
Сообщений: 378
спасибо! Просто в клиентском приложении есть поле ввода даты, там двойным кликом активируется календарь, в нем выбирается дата. Она представляется в именно виде 'дд.мм.гггг', в таблицу пишется к примеру :2010-01-04 00:00:00.000. Вот в чем дело. Set language я уже пробовал, знаю. Мне как то надо интерпретировать введенную дату . В общем, я в самом первом посте сказал, что будет непросто...
9 фев 12, 21:32    [12066069]     Ответить | Цитировать Сообщить модератору
Все форумы / Microsoft SQL Server Ответить