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

Откуда: Кемерово
Сообщений: 1055
...
LEFT JOIN [Address Detailed] ad ON ad.[Owner Code 1] = e.[No_]
...
Ошибка
Error converting data type varchar to float.
Меняю e.[No_] на '1234' все работает... Вы спросите в чем гон? Гон в том, что оба поля имеют тип varchar(20)....
Помогите пожалуйста, не могу сооброзить что серверу надо.

зы Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
3 июн 09, 04:55    [7258732]     Ответить | Цитировать Сообщить модератору
 Re: Ошибка в запросе, гон какойто...  [new]
tpg
Member

Откуда: Novosibirsk
Сообщений: 23902
smoyk
...
LEFT JOIN [Address Detailed] ad ON ad.[Owner Code 1] = e.[No_]
...
Ошибка
Error converting data type varchar to float.
Меняю e.[No_] на '1234' все работает... Вы спросите в чем гон? Гон в том, что оба поля имеют тип varchar(20)....
Помогите пожалуйста, не могу сооброзить что серверу надо.

зы Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 2)
Покажите DDL обеих таблиц.
3 июн 09, 06:18    [7258752]     Ответить | Цитировать Сообщить модератору
 Re: Ошибка в запросе, гон какойто...  [new]
smoyk
Member

Откуда: Кемерово
Сообщений: 1055
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Address Detailed]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Address Detailed]
GO

CREATE TABLE [dbo].[Address Detailed] (
	[timestamp] [timestamp] NOT NULL ,
	[Address Type] [int] NOT NULL ,
	[Owner Code 1] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Owner Code 2] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Home Code] [int] NOT NULL ,
	[Name 1] [varchar] (40) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Name 2] [varchar] (40) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Name 3] [varchar] (40) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Name 4] [varchar] (40) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Name 5] [varchar] (40) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Category 1] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Category 2] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Category 3] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Category 4] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Category 5] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[House] [int] NOT NULL ,
	[Building] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Flat] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Post Index] [varchar] (6) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[GNIMB] [varchar] (4) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Mode] [int] NOT NULL ,
	[Classifier Code] [varchar] (15) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[UserCode] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL 
) ON [Data Filegroup 1]
GO
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Чибис2 ЗАРПЛАТА$Employee]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Чибис2 ЗАРПЛАТА$Employee]
GO

CREATE TABLE [dbo].[Employee] (
	[timestamp] [timestamp] NOT NULL ,
	[No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[First Name] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Middle Name] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Last Name] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Initials] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Job Title] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Search Name] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Address] [varchar] (250) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Address 2] [varchar] (250) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[City] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Post Code] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[County] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Phone No_] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Mobile Phone No_] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[E-Mail] [varchar] (80) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Alt_ Address Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Alt_ Address Start Date] [datetime] NOT NULL ,
	[Alt_ Address End Date] [datetime] NOT NULL ,
	[Picture] [image] NULL ,
	[Birth Date] [datetime] NOT NULL ,
	[Social Security No_] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Union Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Union Membership No_] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Sex] [int] NOT NULL ,
	[Country Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Manager No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Emplymt_ Contract Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Statistics Group Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Employment Date] [datetime] NOT NULL ,
	[Status] [int] NOT NULL ,
	[Inactive Date] [datetime] NOT NULL ,
	[Cause of Inactivity Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Termination Date] [datetime] NOT NULL ,
	[Grounds for Term_ Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Global Dimension 1 Code] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Global Dimension 2 Code] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Resource No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Last Date Modified] [datetime] NOT NULL ,
	[Extension] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Pager] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Fax No_] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Company E-Mail] [varchar] (80) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Title] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Salespers__Purch_ Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[No_ Series] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Department Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Bank Account No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Job Mode] [int] NOT NULL ,
	[Whose Position Employee No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Wage] [decimal](38, 20) NOT NULL ,
	[Vacation Days] [int] NOT NULL ,
	[Vacation Additional Days] [int] NOT NULL ,
	[Person Subject to Call-up] [tinyint] NOT NULL ,
	[Liability for Breakage] [int] NOT NULL ,
	[Ending Inactivity Date] [datetime] NOT NULL ,
	[Privilege] [int] NOT NULL ,
	[Pension Document] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Pension Document Date] [datetime] NOT NULL ,
	[TEK No_] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[TEK Type] [int] NOT NULL ,
	[TEK Date] [datetime] NOT NULL ,
	[Pension Anketa Group No_] [int] NOT NULL ,
	[Pension Anketa No_] [int] NOT NULL ,
	[Manufacturing Type] [int] NOT NULL ,
	[Acceptance Order No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Acceptance Order Date] [datetime] NOT NULL ,
	[Vendor No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Pension Anketa Date] [datetime] NOT NULL ,
	[Birthplace Type] [int] NOT NULL ,
	[Real Post Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Dismissal Planing] [tinyint] NOT NULL ,
	[Document Serias 2] [varchar] (4) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Not Include in Number] [tinyint] NOT NULL ,
	[Conditions Work] [int] NOT NULL ,
	[Category Code Payer] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Bank Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Personal Account No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Dismissal Order No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Dismissal Order Date] [datetime] NOT NULL ,
	[Insurance Company] [varchar] (50) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Ending Date Invalid] [datetime] NOT NULL ,
	[Bank Card No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Ending Date Test] [datetime] NOT NULL ,
	[Contract Date] [datetime] NOT NULL ,
	[Benefit Calc Group] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Calendar Payment Type] [int] NOT NULL ,
	[Additional Tariff] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Territ_ Conditions] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Special Conditions] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Calc Seniority: Reason] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Calc Seniority: Addition] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Long Service: Reason] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Not Include in Time-Sheet] [tinyint] NOT NULL ,
	[Mother_Farther - Alone] [tinyint] NOT NULL ,
	[Contract No_] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Position Code] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Work Mode] [int] NOT NULL ,
	[Position Date] [datetime] NOT NULL ,
	[Work Kind] [int] NOT NULL ,
	[Category Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Ending Contract Date] [datetime] NOT NULL ,
	[Ending Test Date] [datetime] NOT NULL ,
	[Starting Date Unbroken Record] [datetime] NOT NULL ,
	[Starting Date General Record] [datetime] NOT NULL ,
	[General Record Days] [int] NOT NULL ,
	[General Record Month] [int] NOT NULL ,
	[General Record Years] [int] NOT NULL ,
	[City Abbreviation] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Settlement] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Settlement Abbreviation] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Region] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Area Abbreviation] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Street] [varchar] (50) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Street Abbreviation] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[House] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Building] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Apartment] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Document Kind] [varchar] (4) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Document Serias] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Document No_] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Document Company] [varchar] (60) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Document Date] [datetime] NOT NULL ,
	[Visa Address Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Family Status] [int] NOT NULL ,
	[Citizenship] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Nationality] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Native Language] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Address Format] [int] NOT NULL ,
	[Birthplace City] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Birthplace Area] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Birthplace Region] [varchar] (40) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Birthplace Country] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Foreign Passport No_] [varchar] (7) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Foreign Passport Ending Date] [datetime] NOT NULL ,
	[Foreign Passport Serias] [varchar] (2) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Military Rank] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Military Speciality No_] [varchar] (15) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Military Post Group] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Military Category] [int] NOT NULL ,
	[Military Composition] [varchar] (15) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Fitness] [int] NOT NULL ,
	[Special Post No_] [varchar] (15) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Military Regist & Enlistment] [varchar] (50) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Research Work] [int] NOT NULL ,
	[Invention] [int] NOT NULL ,
	[Typewriter] [int] NOT NULL ,
	[Computer] [int] NOT NULL ,
	[Stenography] [int] NOT NULL ,
	[Driving Licence] [int] NOT NULL ,
	[Calc Group] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Blocked] [tinyint] NOT NULL ,
	[Calendar Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Posting Group] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Payer Status] [int] NOT NULL ,
	[Sector] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Specialization] [int] NOT NULL ,
	[Code GNI] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[INN] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Period of Service] [int] NOT NULL ,
	[Beginig Date North Service] [datetime] NOT NULL ,
	[Military Document No_] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[First Name Eng] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Last Name Eng] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Payroll Account No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Payment Account No_] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Birthplace] [varchar] (250) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Foreign Passport Company] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Foreign Passport Starting Date] [datetime] NOT NULL ,
	[G_L Account] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Plant No_] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Expence Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Employment Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Not Include Employee] [tinyint] NOT NULL ,
	[Not Include Cause] [int] NOT NULL ,
	[SubGroup Payment] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Date Person Data] [datetime] NOT NULL ,
	[Command] [varchar] (30) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Payment Code] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Data Signature] [tinyint] NOT NULL ,
	[Signed By UserID] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Military Group] [int] NOT NULL ,
	[Beginig Date Record Service] [datetime] NOT NULL ,
	[Who Replace] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Dismissal Planing Date] [datetime] NOT NULL ,
	[User ID] [varchar] (20) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Reference File Name] [varchar] (150) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Brigade No_] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Worthy Comment] [varchar] (150) COLLATE Cyrillic_General_CI_AS NOT NULL ,
	[Registration Removed] [int] NOT NULL ,
	[Army Service] [tinyint] NOT NULL ,
	[Army Service Starting Date] [datetime] NOT NULL ,
	[Army Service Ending Date] [datetime] NOT NULL ,
	[Service Save] [tinyint] NOT NULL ,
	[Company] [int] NOT NULL ,
	[DateRegistr] [datetime] NOT NULL ,
	[PensType] [int] NOT NULL ,
	[Pension Anketa NP No_] [int] NOT NULL ,
	[Tariff] [varchar] (10) COLLATE Cyrillic_General_CI_AS NOT NULL 
) ON [Data Filegroup 1] TEXTIMAGE_ON [Data Filegroup 1]
GO
3 июн 09, 06:26    [7258757]     Ответить | Цитировать Сообщить модератору
 Re: Ошибка в запросе, гон какойто...  [new]
smoyk
Member

Откуда: Кемерово
Сообщений: 1055
*
CREATE TABLE [dbo].[Чибис2 ЗАРПЛАТА$Employee] (
...
3 июн 09, 06:28    [7258759]     Ответить | Цитировать Сообщить модератору
 Re: Ошибка в запросе, гон какойто...  [new]
smoyk
Member

Откуда: Кемерово
Сообщений: 1055
После
...
LEFT JOIN [Address Detailed] ad ON ad.[Owner Code 1] = Str(e.[No_])
...
ошибок не выдает, но и не работает как надо, т.е. не подтягивает записи...
3 июн 09, 06:35    [7258763]     Ответить | Цитировать Сообщить модератору
 Re: Ошибка в запросе, гон какойто...  [new]
smoyk
Member

Откуда: Кемерово
Сообщений: 1055
Чееерт... нашел ошибку. Дело совсем не в этой строчке, она оказывается влияет лиш косвенно, но влияет, это и ввело в заблуждение. Извиняюсь за беспокойство, исправил)
3 июн 09, 06:43    [7258765]     Ответить | Цитировать Сообщить модератору
Все форумы / Microsoft SQL Server Ответить