Msg 4104 Level 16 The Multi-part Identifier X Could Not Be Bound.
Sep 7, 2007
this is so stupid and simple and I am annoyed over having to spend so much on this silly simple stuff.
I am sure I am just making a silly mistake.
I am trying to remove records from one table. The table holds 19000 something records.
To determine WHICh records to delete, I have another table that contains the 45 I want to delete.
So I wrote this very simple query
Delete from tbl_X
where tbl_X.FieldA = tbl_Y.FieldA;
The message I get is:
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "tblY.FieldA" could not be bound.
Please tell me I am stupid!
Thanks!
View 8 Replies
ADVERTISEMENT
Sep 27, 2006
I'm a newbie have trouble using the "inserted" table in a trigger. When I run these SQL statements:CREATE DATABASE foobarGOUSE foobar GOCREATE TABLE foo ( fooID int IDENTITY (1, 1) NOT NULL, lastUpdated datetime, lastValue int, PRIMARY KEY(fooID))GOCREATE TABLE bar ( barID int IDENTITY (1, 1) NOT NULL, fooID int NOT NULL, [value] int NOT NULL, updated datetime NOT NULL DEFAULT (getdate()), primary key(barID), foreign key(fooID) references foo (fooID))GOCREATE TRIGGER onInsertBarUpdateFoo ON Bar FOR INSERTAS UPDATE Foo SET lastUpdated = inserted.updated, lastValue = inserted.[Value] WHERE foo.fooID = inserted.fooIDGO
I get the error message:
Msg 4104, Level 16, State 1, Procedure onInsertBarUpdateFoo, Line 4
The multi-part identifier "inserted.fooID" could not be bound.
I can get the trigger to work fine as long as I don't reference "inserted".
What am I missing?
I'm using Microsoft SQL Server Management Studio Express 9.00.2047.00 and SQL Express 9.0.1399
Thanks in advance for your help...
Larry
View 7 Replies
View Related
Sep 7, 2006
Hi chaps,
I have the following SQL query (SQL 2005).
Its basically retrieving some values using simple joins.
However there appears to be a problem with the LEFT OUTER JOIN:
"LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
"
When I try to compile the code i Get :
Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "OrderLineItemTransaction.OrderLineItemTransactionI D" could not be bound.
Any help would be appreciated.
Cheers
Bal
SELECT
ord.orderDate,
cc.forename + ' ' + cc.surname person,
prod.description,
oli.noofitems,
deladdr.housenameno + ' ' + deladdr.addressLine1 + ' ' + deladdr.addressLine2 + ' ' + deladdr.city + ' ' + deladdr.postcode + ' ' + deladdr.county + ' ' + deladdr.country deladdress
FROM
product prod,
OrderLineItem oli,
[Order] ord,
OrderTransaction ordT,
OrderLineItemTransaction oliT,
CustomerContact cc,
Customer cust,
DDDispatchedOrder dd,
address deladdr,
address invaddr
LEFT OUTER JOIN DDDispatchedOrder ON (OrderLineItemTransaction.OrderLineItemTransaction ID = DDDispatchedOrder.OrderItemTransactionID)
WHERE
prod.productID = oli.productID:eek:
AND ord.orderID = oli.orderID
AND ord.orderID = ordT.orderID
AND oliT.orderlineitemID = oli.orderlineitemID
AND cc.customercontactID = ord.customercontactID
AND cc.customerID = cust.customerID
AND ord.invoiceaddressID = invaddr.addressID
AND ord.deliveryaddressID = deladdr.addressID
AND ordT.dispatchTypeID = 2
View 7 Replies
View Related
May 29, 2008
I am trying to execute a query in SQL SERVER 2005 for calculating days difference for each. I created a function because there are a lot of calculations. In SPeriods table I have 4 fields that I want to pass as parameters in the table-value function TFC_date_diff, but I receive the error "The multi-part identifier "CC.start_period_no" could not be bound.
Is there a solution for this ?
SELECT CC.start_period_no, CC.end_period_no, CC.start_year, CC.end_year, TFC_date_diff.dates_differnceFROM dbo.[SPeriods] AS CC CROSS JOIN dbo.TFC_date_diff(CC.start_period_no, CC.end_period_no, CC.start_year, CC.end_year) AS TFC_date_diff_1
Thanks a lot in advance!
View 2 Replies
View Related
May 27, 2008
Hi All ,
i am getting this multi-part identifier not found error
followingis my stored procedure
ALTER PROCEDURE [dbo].[Ab_LP]
@gyr char(4),
-- 'A', --'S', only submitted will be returned;
--A=All, or any other letter other than 'S', all will b returned;
@ExONo char(1)='A'
AS
DECLARE @sql VARCHAR(1500)
SET @sql = 'SELECT LTRIM(RTRIM(t1.Last_Name))+'',''+LTRIM(RTRIM(t1.First_Name)) as Name,t2.emaddr as Email,t3.* FROM namesTable as t2,PersonalTable as t1'
IF (@ExONo='S')
SET @sql = LTRIM(RTRIM(@sql)) + ',LePAb AS t3 WHERE t3.emaddr = t2.emaddr AND t2.code = ''ABC'' AND t1.Emplid=t2.Emplid '
ELSE
SET @sql = LTRIM(RTRIM(@sql)) + ' LEFT JOIN LePAb AS t3 ON
t3.emaddr=t2.emaddr WHERE t2.code = ''ABC'' AND t1.Emplid=t2.Emplid '
IF (@gyr <> 0)
SET @sql = LTRIM(RTRIM(@sql)) + ' AND t2.gyr='+@gyr
ELSE
SET @sql = LTRIM(RTRIM(@sql)) + ' AND t1.Code = ''ABC'' '
SET @sql = LTRIM(RTRIM(@sql)) + ' ORDER BY Name'
print @sql
EXEC (@sql)
I am geting an error as
The multi-part identifier "t2.emaddr" could not be bound.
i have tried all the possible tricks but in vain.
plz help..
thanks in advance
View 5 Replies
View Related
Sep 10, 2006
hi,
i don't know what the prob with my code:
create table #tmpAllocation (
[ResourceID] int,
[Resource] varchar(50),
[WorkTeamID] int,
[WorkTeam] varchar(100),
[LineModuleId] int,
[AccountId] varchar(100),
[VpIdentifier] int,
[DivisionId] varchar(100),
[GroupId] int,
[Account/Version] varchar(100),
[version_id] int,
[1] numeric(9,5),[2] numeric(9,5),[3] numeric(9,5),[4] numeric(9,5),[5] numeric(9,5), numeric(9,5),[7] numeric(9,5), numeric(9,5),[9] numeric(9,5),
[10] numeric(9,5),[11] numeric(9,5),[12] numeric(9,5),[13] numeric(9,5),[14] numeric(9,5),[15] numeric(9,5),[16] numeric(9,5),[17] numeric(9,5),[18] numeric(9,5),
[19] numeric(9,5),[20] numeric(9,5),[21] numeric(9,5),[22] numeric(9,5),[23] numeric(9,5),[24] numeric(9,5),[25] numeric(9,5),[26] numeric(9,5),[27] numeric(9,5),
[28] numeric(9,5),[29] numeric(9,5),[30] numeric(9,5),[31] numeric(9,5),[32] numeric(9,5),[33] numeric(9,5),[34] numeric(9,5),[35] numeric(9,5),[36] numeric(9,5),
[37] numeric(9,5),[38] numeric(9,5),[39] numeric(9,5),[40] numeric(9,5),[41] numeric(9,5),[42] numeric(9,5),[43] numeric(9,5),[44] numeric(9,5),[45] numeric(9,5),
[46] numeric(9,5),[47] numeric(9,5),[48] numeric(9,5),[49] numeric(9,5),[50] numeric(9,5),[51] numeric(9,5),[52] numeric(9,5),[53] numeric(9,5))
insert into #tmpAllocation
select msp_resources.emp_code as [ResourceID],
msp_resources.res_name as [Resource],
WorkTeam.workteam_id as [WorkTeamID],
acc.account_name + ' / ' + WorkTeam.workteam_name as [WorkTeam],
line_module.line_module_id as [LineModuleId],
acc.account_id as [AccountId],
vp.vp_identifier as [VpIdentifier],
division.division_id as [DivisionId],
division.group_id as [GroupId],
Account.account_name + ' / ' + Version.version_name as [Account/Version],
Version.version_id as [version_id],
Version_Resources_Allocation.pct_allocation [pct_allocation]
from WorkTeam, Version_Resources_Allocation
pivot (sum(pct_allocation )
for Version_Resources_Allocation.week IN ([1],[2],[3],[4],[5],,[7],,[9],[10],[11],[12],[13],[14],[15],[16],[17],[18],[19],[20],[21],[22],[23],[24],[25],[26],[27],[28],[29],[30],[31],[32],[33],[34],[35],[36],[37],[38],[39],[40],[41],[42],[43],[44],[45],[46],[47],[48],[49],[50],[51],[52], [53])) as pvt
inner join Version_Resources_Allocation on WorkTeam.workteam_id = Version_Resources_Allocation.workteam_id
inner join WorkTeam_Resources_Assignments on WorkTeam_Resources_Assignments.resource_id = Version_Resources_Allocation.resource_id
and WorkTeam_Resources_Assignments.workteam_id = Version_Resources_Allocation.workteam_id
inner join calendar on calendar.year = WorkTeam_Resources_Assignments.year
and calendar.month = WorkTeam_Resources_Assignments.month
and calendar.year = Version_Resources_Allocation.year
and calendar.week = Version_Resources_Allocation.week
inner join Version on Version.version_id = Version_Resources_Allocation.version_id
inner join Account on Account.account_id = Version.account_id
--hierarchy joins
inner join line_module on line_module.line_module_id = WorkTeam.line_module_id
inner join Account as acc on acc.account_id = line_module.account_id
inner join vp on vp.vp_identifier = acc.vp_identifier
inner join division on division.division_id = vp.division_id
--Resources joins
inner join msp_resources on msp_resources.emp_code = Version_Resources_Allocation.resource_id
where Version_Resources_Allocation.resource_id in (select top 100 percent emp_code from #staffEmployees where id between ((@quota * (@pageIndex - 1) + 1)) and (@quota * @pageIndex) order by res_name)
and
(
(Version_Resources_Allocation.year = @startYear and Version_Resources_Allocation.week >= @startWeek and Version_Resources_Allocation.week <= (case when @startYear = @endYear then @endWeek else @maxWeeksInFirstYear end))
or
(Version_Resources_Allocation.year = @endYear and Version_Resources_Allocation.week <= @endWeek and Version_Resources_Allocation.week >= (case when @startYear = @endYear then @startWeek else 1 end))
)
and
(
pct_availability!=0 or (pct_availability is null and staffing_pct_availability!=0)
)
and
(
(WorkTeam_Resources_Assignments.year = @startYear and WorkTeam_Resources_Assignments.month >= @startMonth and WorkTeam_Resources_Assignments.month <=
case when @startYear = @endYear then @endMonth else 12 end
)
or
(WorkTeam_Resources_Assignments.year = @endYear and WorkTeam_Resources_Assignments.month <= @endMonth and WorkTeam_Resources_Assignments.month >=
case when @startYear = @endYear then @startMonth else 1 end
)
)
--and pct_allocation is not null
group by msp_resources.emp_code,
msp_resources.res_name,
WorkTeam.workteam_id,
WorkTeam.workteam_name,
line_module.line_module_id,
acc.account_id,
acc.account_name,
vp.vp_identifier,
division.division_id,
division.group_id,
Account.account_name + ' / ' + Version.version_name,
acc.account_name+ ' / ' + WorkTeam.workteam_name,
Version.version_id
I get:
The multi-part identifier "WorkTeam.workteam_id" could not be bound.
The multi-part identifier "WorkTeam.line_module_id" could not be bound.
Why?
Thanks,
Omri
View 4 Replies
View Related
Jan 19, 2013
Which the column name is the c.Documenttype
here is my T-sql code..
SELECT [Hourly]
,count(case when C.Documenttype=1 THEN '1' END) as EDI
,count(case when C.Documenttype=2 THEN '2' END) as SI
,count(case when C.Documenttype=1 THEN '1' END) + count(case when C.Documenttype=2 THEN '2' END) as GrandTotal
[Code] ....
View 2 Replies
View Related
Feb 15, 2008
I try to automate ans insert (that ok) and update jobs
but these part is not working I got the following error
The multi-part identifier "t2.customerid" could not be bound.
any idea'll be welcomed I'm not so good in programming and sql
update [ADOS].[dbo].[Customers]
set t2.companyname = t1.companyname
where t2.customerid = (SELECT t1.companyname
FROM [Northwind].[dbo].[Customers] T1 inner join [ADOS].[dbo].[Customers] T2 on (t1.customerid = t2.customerid and t1.companyname <>t2.companyname))
View 13 Replies
View Related
Oct 16, 2007
Hello,
I am running
Microsoft SQL Server 2005 - 9.00.2047.00 (Intel X86)
Apr 14 2006 01:12:25
Copyright (
c) 1988-2005 Microsoft Corporation
Developer Edition on Windows NT 5.1 (Build 260
0: Service Pack 2)
on Windows.
using jdbc
<driver name="com.microsoft.sqlserver.jdbc.SQLServerDriver" tag="sqlserver"
url="jdbcqlserver://[host]:[port];DatabaseName=[dbname];user=[user];password=[password]">
<jar subdir="sqlserver" name="sqljdbc.jar" />
</driver>
I print out the following info to make sure I get the right driver:
'JDBC driver details' , ' driver class name=com.microsoft.sqlserver.jdbc.SQLServerDriver
driver majorVersion=1
driver minorVersion=1
driver a genuine JDBC CompliantTM driver=true'
I execute the following query
SELECT p.cust_id,
p.stock_units FROM dbo.customer_portfolio p
WHERE p.stock_price = ?
and get this message:
com.microsoft.sqlserver.jdbc.SQLServerException: The multi-part identifier "p.stock_price" could not be bound. stack trace: [com.microsoft.sqlserver.jdbc.SQLServerException.makeFromDriverError(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerParameterMetaData.<init>(Unknown Source)
com.microsoft.sqlserver.jdbc.SQLServerPreparedStatement.getParameterMetaData(Unknown Source)
If I change it to:
SELECT cust_id,
stock_units FROM dbo.customer_portfolio
WHERE stock_price = ?
i.e. do not use correlation names, it executes as expected. Is there anything wrong with using correlation names in the query ? or is it a bug ?. Any help will be welcome.
View 3 Replies
View Related
Mar 24, 2008
I am trying to run a Common Table Expression (CTE) in SQL Server 2005 but I receive the error
'Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "ep.ProjectUID" could not be bound'.
What does this error mean?
My SQL is:
Code Snippet
WITH Tasks (TaskParentUID, TaskUID, ProjectName, TaskName, Level)
AS
(
SELECT et.TaskParentUID, TaskUID, ProjectName, TaskName,
0 AS Level
FROM dbo.MSP_EpmProject as ep
INNER JOIN dbo.MSP_EpmTask as et
ON ep.ProjectUID = et.ProjectUID
WHERE et.TaskParentUID = et.TaskUID
UNION ALL
SELECT et.TaskParentUID, et.TaskUID, ep.ProjectName, et.TaskName,
Level + 1
FROM dbo.MSP_EpmProject as ep
INNER JOIN dbo.MSP_EpmTask as et
ON ep.ProjectUID = et.ProjectUID
INNER JOIN Tasks AS t
ON et.TaskParentUID = t.TaskUID
)
SELECT t.TaskParentUID, t.TaskUID, ProjectName, t.TaskName, Level
FROM Tasks as t
INNER JOIN dbo.MSP_EpmTask as et
ON Tasks.TaskParentUID = et.TaskParentUID
WHERE Level = 0
The TaskParentUID has data-type of UniqueIdentifier and it's child is TaskUID which is also a UniqueIdentifier type. My goal of this CTE is to list all child TaskUIDs for each TaskParentUID in a recursive fashion.
View 7 Replies
View Related
Dec 3, 2007
HI,
This query gets generated when I try to execute my dlinq query in .net. It throws error
The multi-part identifier "t0.CategoryId" could not be bound.
CategoryId is a primary field in Category table. Although we don't select it in the query, it throws above error.
SELECT [t0].[CategoryName], [t3].[CategoryConditionId], [t3].[ConditionId]
FROM [Category] AS [t0]
CROSS APPLY (
SELECT NULL AS [EMPTY]
) AS [t1]
LEFT OUTER JOIN (
SELECT [t2].[CategoryConditionId], [t2].[ConditionId], [t2].[CategoryId]
FROM [CategoryCondition] AS [t2]
WHERE [t0].[CategoryId] = [t2].[CategoryId]
) AS [t3] ON 1=1
CROSS JOIN [Condition] AS [t4]
WHERE [t3].[ConditionId] = [t4].[ConditionId]
Any help would be appreciated.
View 3 Replies
View Related
Mar 11, 2008
Hi,We moved our stored procedure from sql 2000 to sql 2005 and we're getting few weird errors:Msg 4104. multi-part identifier /table.column/ could not be bound.Do we have to change anything in the stored procedure in order to make it work for sql 2005? Errors point to lines 25 and 68:25: IF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GC_Contacts_Table]') AND type in (N'U'))68: ELSEBelow is the code. Thanks in advance.set ANSI_NULLS ONset QUOTED_IDENTIFIER ONGOALTER PROCEDURE [dbo].[sp_refresh_GC_Contacts]ASDECLARE@dropSQL varchar(2000)BEGINSET NOCOUNT ON;--SET IDENTITY_INSERT GC_Contacts_Table ON-- drop the fulltext indexIF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[GC_Contacts]') AND name = N'pk_gc_contacts')DROP FULLTEXT INDEX ON [dbo].[GC_Contacts] -- drop the unique indexIF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[GC_Contacts]') AND name = N'pk_gc_contacts')DROP INDEX [pk_gc_contacts] ON [dbo].[GC_Contacts] WITH ( ONLINE = OFF )-- If table exists truncate itIF EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[GC_Contacts_Table]') AND type in (N'U'))BEGIN TRUNCATE TABLE [dbo].[GC_Contacts_Table]INSERT INTO [dbo].[GC_Contacts_Table] --insert sql next lineSELECT Title, FirstName AS First_Name, MiddleName AS Middle_Name, LastName AS Last_Name,Suffix, Company, JobTitle AS Job_Title, Email, PrimaryPhoneNumber AS Primary_Phone_Number, PrimaryAddress1 AS Primary_Address_1, PrimaryAddress2 AS Primary_Address_2, PrimaryAddress3 AS Primary_Address_3, PrimaryCity AS Primary_City, PrimaryState AS Primary_State,PrimaryZip AS Primary_Zip, PrimaryCountry AS CPrimary_ountry, Notes, Alias, FullName AS Full_Name,dbo.Addresses.Type AS AddressType, dbo.Addresses.Address1 AS Address1,dbo.Addresses.Address2 AS Address2,dbo.Addresses.Address3 AS Address3, dbo.Addresses.City AS City, dbo.Addresses.State AS State,dbo.Addresses.Zip as Zipcode, dbo.Addresses.Country AS Country, dbo.Addresses.PhoneNumber AS PhoneNumber,dbo.Addresses.FaxNumber AS FaxNumber, SubAward_Only = CASE SubAwardOnlyWHEN 0 THEN 'No'WHEN 1 THEN 'Yes'END,dbo.ContactsSTUDF.*-- IDENTITY(int, 1,1) AS GC_Contact_ID-- INTO dbo.GC_Contacts_TableFROM dbo.Contacts LEFT OUTER JOIN dbo.ContactAddresses ON dboContacts.ID = dboContactAddresses.ContactIDLEFT OUTER JOIN dbo.Addresses ON dbo.Addresses.ID = dboContactAddresses.AddressIDLEFT OUTER JOIN dbo.ContactsSTUDF ON dbo.Contacts.ID = dbo.ContactsSTUDF.EntityIDENDELSE BEGIN-- create the table from the querySELECT Title, FirstName AS First_Name, MiddleName AS Middle_Name, LastName AS Last_Name, Suffix, Company,JobTitle AS Job_Title, Email, PrimaryPhoneNumber AS Primary_Phone_Number, PrimaryAddress1 AS Primary_Address_1, PrimaryAddress2 AS Primary_Address_2, PrimaryAddress3 AS Primary_Address_3, PrimaryCity AS Primary_City, PrimaryState AS Primary_State, PrimaryZip AS Primary_Zip, PrimaryCountry AS CPrimary_ountry, Notes, Alias, FullName AS Full_Name,dbo.Addresses.Type AS AddressType, dbo.Addresses.Address2 AS Address2,dbo.Addresses.Address3 AS Address3, dbo.Addresses.City AS City, dbo.Addresses.State AS State,dbo.Addresses.Zip as Zipcode, dbo.Addresses.Country AS Country, dbo.Addresses.PhoneNumber AS PhoneNumber,dbo.Addresses.FaxNumber AS FaxNumber, SubAward_Only = CASE SubAwardOnlyWHEN 0 THEN 'No'WHEN 1 THEN 'Yes'END,dbo.ContactsSTUDF.*,IDENTITY(int, 1,1) AS GC_Contact_IDINTO dbo.GC_Contacts_TableFROM dbo.Contacts LEFT OUTER JOIN dbo.ContactAddresses ON dboContacts.ID = dboContactAddresses.ContactIDLEFT OUTER JOIN dbo.Addresses ON dbo.Addresses.ID = dboContactAddresses.AddressIDLEFT OUTER JOIN dbo.ContactsSTUDF ON dbo.Contacts.ID = dbo.ContactsSTUDF.EntityIDEND SET IDENTITY_INSERT GC_Contacts_table OFFSET ARITHABORT ONSET CONCAT_NULL_YIELDS_NULL ONSET QUOTED_IDENTIFIER ONSET ANSI_NULLS ONSET ANSI_PADDING ONSET ANSI_WARNINGS ONSET NUMERIC_ROUNDABORT OFF/****** Object: Index [pk_gc_contacts] Script Date: 10/11/2007 15:34:28 ******/CREATE UNIQUE CLUSTERED INDEX [pk_gc_contacts] ON [dbo].[GC_Contacts] ([GC_contact_id] ASC)WITH (SORT_IN_TEMPDB = OFF, DROP_EXISTING = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF) ON [PRIMARY]-- add the fulltext indexCREATE FULLTEXT INDEX ON GC_Contacts([Title],[First_Name],[Middle_Name],[Last_Name],[Suffix],[Company],[Job_Title],[Email],[Primary_Phone_Number],[Primary_Address_1],[Primary_Address_2],[Primary_Address_3],[Primary_City],[Primary_State],[CPrimary_ountry],[Notes],[Alias],[Full_Name],[AddressType],[Address1],[Address2],[Address3],[City],[State],[Country],[PhoneNumber],[FaxNumber],[SubAward_Only])KEY INDEX pk_gc_contacts ON GCInquiryCatalogWITH CHANGE_TRACKING AUTOEND
View 3 Replies
View Related
Aug 17, 2007
Hi, Im trying to run this query
UPDATE DataModif
SET t.Ind_des = Replace (t.Tit_Des,"'",'"')
FROM Tit_Modificables t
WHERE
t.Ind_num in
(SELECT CAST (t2.Ind_num AS VARCHAR(10))
FROM Tit_Modificables t2
WHERE t2.Emp_id ='1100004' AND t2.Ejercicio_fiscal = 2003 AND t2.Nom_tabla = CAST (10 AS NUMERIC))
but ir sends this message error
The multi-part identifier "t.Ind_num" could not be bound.
I don't know if there is a problem because I'm using an Update.. FROM
Any help?
View 6 Replies
View Related
Apr 28, 2006
Hi,
When I try execute one query in SQL 2k5, with alias in order by clausule, I retrieve the follow message:
Server: Msg 4104, Level 16, State 1, Line 1
The multi-part identifier "alias.fields" could not be bound.
Where alias is a any alias and, fields is a field of the table with alias.
Already exists one fix to patch this?
Thanks
View 39 Replies
View Related
Feb 16, 2007
Hello everyone!
I'm having a problem in using MS SQL 2005 as an ODBC in Powerbuilder 10.
My query which seems to work in Powerbuilder 5 does not work in Powerbuilder 10.
When I execute my query, I got this message "multi-part identifier alias.fieldname could not be bound. I don't know what's seems wrong. I even tried putting no alias but still it won't work..
help me please...
select sc.transaction_code,
case when :as_transtype = '' then drh.so_number else case when :as_transtype = 'SI' then drh.si_number else case when :as_transtype = 'DR' then drh.dr_number else :ad_documentnumber end end end document_number,
case when :as_transtype = '' then drh.so_date else case when :as_transtype = 'SI' then drh.si_date else case when :as_transtype = 'DR' then drh.dr_date end end end transaction_date,
pcd.item_number,
pcd.serial_number,
pcd.serv_tag,
pcd.rev_no,
space(10) supplier_name,
c.customer_name,
pcd.pcc_number,
pcd.supplier_refdocno,
pcd.ref_date,
pcd.original_tag,
pcd.item_description
from pcc_detail pcd
inner join pcc_header pch
on pch.pcc_number = pcd.pcc_number
inner join delivery_receipt_header drh
on pch.so_number = drh.so_number
inner join stock_card sc
on sc.so_number = drh.so_number and
sc.item_number = pcd.item_number
inner join customer c
on drh.customer_code = c.customer_code
where sc.transaction_code in ('DR', 'SE') and
sc.transaction_type <> 'RS' and
sc.item_number like case when :as_itemnumber = '' then sc.item_number else '%' + :as_itemnumber + '%' end and
pcd.serv_tag like case when :as_servicetag = '' then pcd.serv_tag else '%' + :as_servicetag + '%' end and
pcd.serial_number like case when :as_serialnumber = '' then pcd.serial_number else '%' + :as_serialnumber + '%' end and
pch.customer_name like case when :as_customer = '' then pch.customer_name else '%' + :as_customer + '%' end and
:as_transtype in ('SO','SI','DR','PC','') and
sc.transaction_code = case when :as_transtype = 'SI' then 'SE' else 'DR' end and
( pch.so_number = case when :ad_documentnumber = 0 then pch.so_number else :ad_documentnumber end or
pch.si_number = case when :ad_documentnumber = 0 then pch.si_number else :ad_documentnumber end or
pch.pcc_number like case when :ad_documentnumber = '' then pch.pcc_number else '%' + :as_documentnumber + '%' end or
pch.dr_number = case when :ad_documentnumber = 0 then pch.dr_number else :ad_documentnumber end
) and
pcd.item_description like case when :as_itemdesc = '' then pcd.item_description else '%' + :as_itemdesc + '%' end
this is my query
View 3 Replies
View Related
Nov 14, 2006
Hello,
I use IBM WebSphere Portal and am desperately trying to move data from the default Cloudspace Database to MS SQL Server 2005, of course following the official guidelines.
What happens is that WebSphere's Configuration Wizard fails because of an error caused by the SQL Script. Trouble is, I can't bring it to work not even in the SQL Server Management Studio.
What follows is the code generated by the script. The error is caused by the last "check"-constraint (colored in red).
CREATE TABLE community.APP_DESC ( OID BINARY(18) NOT NULL, TYPE INTEGER NOT NULL, APP_NAME NVARCHAR(255) NOT NULL, IS_ACTIVE INTEGER NOT NULL, JSR_VERSION NVARCHAR(255), GUID NVARCHAR(255), WEB_MOD_OID BINARY(18), WEB_MOD_SL BINARY(18), WSRP_PROD_OID BINARY(18), WSRP_PROD_SL BINARY(18), DEFAULT_LOCALE NVARCHAR(64), CREATED BIGINT NOT NULL, MODIFIED BIGINT NOT NULL, WSC_GROUP_ID NVARCHAR(255), CONSTRAINT PK20 PRIMARY KEY NONCLUSTERED (OID), CONSTRAINT FK20A FOREIGN KEY (WEB_MOD_OID) REFERENCES community.WEB_MOD (OID) ON DELETE CASCADE, constraint FK20B FOREIGN KEY (WSRP_PROD_OID) REFERENCES community.WSRP_PROD (OID) ON DELETE CASCADE, CONSTRAINT CC20A CHECK (((community.APP_DESC.WEB_MOD_OID IS NULL) AND (community.APP_DESC.WEB_MOD_SL IS NOT NULL)) OR ((community.APP_DESC.WEB_MOD_OID IS NOT NULL) AND (community.APP_DESC.WEB_MOD_SL IS NULL))) )
And that's what SQL Server 2005 told me:
Msg 4104, Level 16, State 1, Line 1The multi-part identifier "community.APP_DESC.WEB_MOD_OID" could not be bound.Msg 4104, Level 16, State 1, Line 1The multi-part identifier "community.APP_DESC.WEB_MOD_SL" could not be bound.Msg 4104, Level 16, State 1, Line 1The multi-part identifier "community.APP_DESC.WEB_MOD_OID" could not be bound.Msg 4104, Level 16, State 1, Line 1The multi-part identifier "community.APP_DESC.WEB_MOD_SL" could not be bound.
BTW, as this is a generated script I do not have the possibility to change it. Because it has been released by IBM I am rather convinced that it is correct - therefore I was wondering whether SQL Server 2005 has a known bug that makes it refuse "check"-constraints.
Any hint is very appreciated.
Thanks in advance,
adapter
View 4 Replies
View Related
Jan 14, 2008
can anybody please help me on this error -
The multi-part identifier "tablename.fldname" could not be bound.
update sub_purchase
set sub_purchase.ic_status=0, sub_purchase.qty_bal=sub_purchase.qty_bal+ sub_sales.qty_bal, sub_purchase.qty_issued=sub_purchase.qty_issued-sub_sales.qty_bal
where sub_purchase.item_code=sub_sales.item_code and sub_sales.purchase_id=sub_purchase.purchase_id and sub_sales.sales_id= 1
View 3 Replies
View Related
May 12, 2008
Using
- SQL Server 2005
- Management Studio Express.
Here's the SQL statement
Code Snippet
SELECT TOP 1000
[test].[CatalogStudioId],
[test].[CollectionId],
[test].[unique],
[test].[att1]
FROM CatalogStudioEntity.dbo.[test]
WHERE [test].[att1] LIKE '%1%'
Now, before you respond, allow me to say that I know using the table name to qualify the columns is redundant, and I know there are other options (such as aliasing the table). Don't respond to tell me this. However -- as far as I know -- this is a valid T-SQL statement and I should be able to get this query to run.
The interesting part is that if management studio is connected to the CatalogStudioEntity database, this query runs fine. If connected to the master database, I get the "multi-part identifier [x] could not be bound" error. The error is listed for every column.
My issue with this is that the table in the FROM clause is qualified with the database name, so whether I'm connected to that database or to "master" should not matter.
I have an application that generates select statements like the one above, and all of the machines so far that we've developed, beta tested and deployed this application on all don't have this problem. It's this one specific installation of SQL Server 2005 on this new machine where this problem arises.
Before I go back and retool the application to output whatever arbitrary syntax this specific machine seems to want, I want to try and troubleshoot and understand why it's acting like this.
Any ideas or thoughts would be greatly appreciated.
View 3 Replies
View Related
Jan 17, 2007
Im trying to execute following update SQL:
UPDATE Property SET ImageList = U.ImageList
FROM Property M
INNER JOIN RETS.dbo._Updates U ON M.ListingID = U.ListingID AND M.FeedID
= U.FeedID
WHERE M.FeedID = ?
But following error:
[Execute SQL Task] Error: Executing the query " UPDATE Property SET
ImageList = U.ImageList FROM Property
M INNER JOIN RETS.dbo._Updates U ON M.ListingID = U.ListingID
AND M.FeedID = U.FeedID WHERE M.FeedID = ?" failed with
the following error: "The multi-part identifier "M.FeedID" could
not be bound.". Possible failure reasons: Problems with the query,
"ResultSet" property not set correctly, parameters not set correctly,
or connection not established correctly.
ByPassPrepare is set to TRUE and ParameterName = 0 to variable User::Feed_ID
HOWEVER - following query executes fine:
UPDATE Property SET
ImageList = U.ImageList
FROM Property M
INNER JOIN RETS.dbo._Updates U ON M.ListingID = U.ListingID AND M.FeedID
= U.FeedID
WHERE M.FeedID = 11
Beats me - any help with explaining this to me
please?
View 7 Replies
View Related
Jun 2, 2006
I was trying to copy child records of one parent record into another, and wanted to report back new child record id and corresponding child record id that was used to create it. I ran into run-time error with OUTPUT clause. Following is a script that will duplicate the situation I ran into:
CREATE TABLE Parent(
ParentID INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
ParentName VARCHAR(50) NOT NULL)
GO
CREATE TABLE Child(
ChildID INT NOT NULL IDENTITY(1,1) PRIMARY KEY,
ParentID INT NOT NULL REFERENCES Parent(ParentID),
ChildName VARCHAR(50) NOT NULL)
GO
INSERT INTO Parent(ParentName) VALUES('Parent 1')
INSERT INTO Parent(ParentName) VALUES('Parent 2')
GO
INSERT INTO Child(ParentID, ChildName) VALUES(1, 'Child 1')
INSERT INTO Child(ParentID, ChildName) VALUES(1, 'Child 2')
GO
At this stage, there Child table looks like:
ChildID
ParentID
ChildName
1
1
Child 1
2
1
Child 2
What I want to do is copy Parent 1€™s children to Parent 2, and report back which source ChildID that was used to create the new child records. So I wrote the query:
DECLARE @LinkTable TABLE (FromChildID INT, ToChildID INT)
INSERT INTO Child(ParentID, ChildName)
OUTPUT c.ChildID, inserted.ChildID INTO @LinkTable
SELECT 2, c.ChildName
FROM Child c
WHERE c.ParentID = 1
SELECT * FROM @LinkTable
In the end I was expecting Child table to look like:
ChildID
ParentID
ChildName
1
1
Child 1
2
1
Child 2
3
2
Child 1
4
2
Child 2
and OUTPUT clause to return me:
FromChildID
ToChildID
1
3
Child record with ID 3 was created using ID of 1.
2
4
Child record with ID 4 was created using ID of 2.
But infact I€™m getting following error:
Msg 4104, Level 16, State 1, Line 9
The multi-part identifier "c.ChildID" could not be bound.
Any ideas on how to fix the OUTPUT clause in the query to return me the expected output?
Thanks
Yogesh
View 7 Replies
View Related
Nov 6, 2006
Hello,
i am facing a bizarre problem, accessing data from a remote server which has been linked to my sql.
My SQL server is 2005 and the remote server is SQL 2000.
i have linked the remote server (called LinkedServer) so that when i run this query:
SELECT * FROM LinkedServer.SomeDB.dbo.SomeTable
executes successfully! However, when i run a similar query like this:
SELECT Column1 AS Col1,
LinkedServer.SomeDB.dbo.SomeTable.Column2 as Col2,
Alias.Column3 as Col3
FROM LinkedServer.SomeDB.dbo.SomeTable
INNER JOIN LinkedServer.SomeDB.dbo.SomeOtherTable1 ON LinkedServer.SomeDB.dbo.SomeTable.Column3 = LinkedServer.SomeDB.dbo.SomeOtherTable1.Column3
INNER JOIN LinkedServer.SomeDB.dbo.SomeOtherTable2 AS Alias
ON LinkedServer.SomeDB.dbo.SomeTable.Column3 = Alias.Column3
It gives me this error:
The multi-part identifier "LinkedServer.SomeDB.dbo.SomeTable.Column2" could not be bound.
The multi-part identifier "LinkedServer.SomeDB.dbo.SomeTable.Column3" could not be bound.
I have noticed that this error is generated only for the selected columns whose path has either been repeated (e.g. "LinkedServer.SomeDB.dbo.SomeTable.Column2" as opposed to "Column2") or for columns which are from aliased tables.
What is going on?!?!?!??!?!?!
Any Help would be tremendously appreciated!!!! 8..)
View 8 Replies
View Related
Nov 20, 2006
Hi Everyone
This is the query and I am getting follwoing error message
"The multi-part identifier "InvDate.Account Reference" could not be bound."
SELECT MAX([DATE NOTE ADDED]) AS LASTDATE,
CC.[COMPANY],
CC.[ACCOUNT REFERENCE],
INVDATE.[LASTORDERDATE]
FROM CUSTOMERCONTACTNOTES AS CCN,
(SELECT *
FROM CUSTOMER) AS CC,
(SELECT MAX([INVOICE DATE]) AS LASTORDERDATE,
[ACCOUNT REFERENCE]
FROM INVOICEDATA
GROUP BY [ACCOUNT REFERENCE]) AS INVDATE
WHERE CCN.[COMPANY] = CC.[COMPANY]
AND CC.[ACCOUNT REFERENCE] COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS IN (SELECT DISTINCT ([ACCOUNT REFERENCE])
FROM INVOICEDATA)
AND CC.[ACCOUNT REFERENCE] COLLATE SQL_LATIN1_GENERAL_CP1_CI_AS = INVDATE.[ACCOUNT REFERENCE]
GROUP BY CC.[COMPANY],CC.[ACCOUNT REFERENCE]
ORDER BY CC.COMPANY ASC
By the way its SQL Server 2005 Environment.
Mitesh
View 4 Replies
View Related
Apr 17, 2007
Hi: I'm try to create a stored procedure where I sum the amounts in an invoice and then store that summed amount in the Invoice record. My attempts at this have been me with the error "The multi-part identifier "items.TAX" could not be bound"Any help at correcting my procedure would be greatly appreciate. Regards,Roger Swetnam ALTER PROCEDURE [dbo].[UpdateInvoiceSummary] @Invoice_ID intAS DECLARE @Amount intBEGIN SELECT Invoice_ID, SUM(Rate * Quantity) AS Amount, SUM(PST) AS TAX FROM InvoiceItems AS items GROUP BY Invoice_ID HAVING (Invoice_ID = @Invoice_ID) Update Invoices SET Amount = items.Amount WHERE Invoice_ID =@Invoice_IDEND
View 3 Replies
View Related
May 12, 2008
Before you ask, yes I know this is a common-ish error message and I have been searching around for a bit for solutions. The problem is, however, is that the query I'm trying to run is so incredibly simple that those solutions don't really apply...
Here's the SQL:
select top 1000
[test].[CatalogStudioId],
[test].[CollectionId],
[test].[unique],
[test].[att1]
from CatalogStudioEntity.dbo.[test]
where [test].[att1] like '%1%'
And apparently none of those columns can be bound.
Queries of this general syntax have worked on SQL Server 2005 installations I've been working on until now, so what could possibly be screwy with this specific installation where that query doesn't work?
And yes, I know using the table name to qualify the columns is redundant and I know there are other options (such as using aliases), but I'd rather try to troubleshoot this before reworking the code that generates these sql queries.
Thanks!
View 7 Replies
View Related
Jul 2, 2007
HI Gurus,
Trying to alter an existing Trigger on an insert event on one of our tables. The following sql generates: "Msg 4104, Level 16, State 1, Procedure insxECSIBHEADER, Line 4 The multi-part identifier "INSERTED.PROJECT" could not be bound."
Here's the SQL itself:
set QUOTED_IDENTIFIER ONgoALTER TRIGGER [insxECSIBHEADER] ON [dbo].[xECSIBHeader] AFTER INSERT AS BEGIN IF SUBSTRING(INSERTED.[PROJECT],4,2) = 'DR' BEGIN UPDATE xECSIBHEADER SET xECSIBHEADER.[IBNUMBER] = LEFT(xECSIBHEADER.[PROJECT],2) + 'D' + Cast(xECSIBHEADER.[IBHeaderKey] AS VarChar(15)) FROM INSERTED INS INNER JOIN xECSIBHEADER ON xECSIBHEADER.[IBHeaderKey] = INS.[IBHeaderKey] WHERE INS.[IBNUMBER] IS NULL END ELSE BEGIN UPDATE xECSIBHEADER SET xECSIBHEADER.[IBNUMBER] = LEFT(xECSIBHEADER.[PROJECT],2) + Cast(xECSIBHEADER.[IBHeaderKey] AS VarChar(15)) FROM INSERTED INS INNER JOIN xECSIBHEADER ON xECSIBHEADER.[IBHeaderKey] = INS.[IBHeaderKey] WHERE INS.[IBNUMBER] IS NULL END
END
View 6 Replies
View Related
Nov 25, 2007
I have created the following temp table.
--DROP TABLE #temp_Table
--select 0 as Populated, c.Table_name, Column_name, Ordinal_position, Value, Data_type, Character_maximum_length
-- INTO #temp_Table
-- from
--(SELECT 'lists' AS 'TABLE_NAME', *
-- FROM ::fn_listextendedproperty (NULL, 'user', 'dbo', 'table', 'Lists', 'column', default))c
--INNER JOIN
-- (SELECT * FROM INFORMATION_SCHEMA.columns)d
-- ON c.objname = d.column_name COLLATE Latin1_General_CI_AI
-- AND c.TABLE_NAME = d.TABLE_NAME
--ORDER BY d.Ordinal_Position
--select * from #Temp_Table
The temp table above #Temp_Table has these 2 columns among others.
Table_Name, Column_name
Lists.......ListID
Lists.......ItemName
Lists.......ItemAbbreviation
Lists.......ItemDescription
From the table named in the Table_Name column I want to populate a new column named "Populated" with the count of rows based on this select:
SELECT COUNT(*) FROM Lists WHERE Len(Notes)<> 0
So that I will end up with:
Table_Name ...Column_name ........Populated
Lists...............ListID......................22
Lists...............ItemName...............10
Lists...............ItemAbbreviation......20
Lists...............ItemDescription.......5
My attempt at writing this select is as follows.
select *, populated from #Temp_Table #t
--loop through table for getting count of all columns.
WHILE #t.Ordinal_position IS NOT NULL
begin
Update #t
set populated = (SELECT COUNT(*) FROM Lists WHERE Len(Notes)<> 0)
end
And get this error
Msg 4104, Level 16, State 1, Line 3
The multi-part identifier "#t.Ordinal_position" could not be bound.
How do i correct this?
View 1 Replies
View Related
Jun 18, 2008
use projectserver2003
selectr.RES_NAME, p.PROJ_NAME, a.TASK_NAME, w.WWORK_START, w.WWORK_FINISH, w.WWORK_VALUE
from MSP_WEB_RESOURCES r,
MSP_WEB_ASSIGNMENTS a,
MSP_WEB_PROJECTS p,
MSP_WEB_WORK w
join MSP_VIEW_PROJ_TASKS_ENT TE on r.WPROJ_ID=TE.WPROJ_ID
join MSP_VIEW_PROJ_RES_ENT RE on r.WPROJ_ID=RE.WPROJ_ID
join MSP_VIEW_PROJ_PROJECTS_ENT PE on r.WPROJ_ID=PE.WPROJ_ID
wherew.WWORK_TYPE = 1 -- actual work
andw.WASSN_ID = a.WASSN_ID
anda.WPROJ_ID = p.WPROJ_ID
anda.WRES_ID = r.WRES_ID
This statement is returning the following errors:
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "r.WPROJ_ID" could not be bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "r.WPROJ_ID" could not be bound.
Msg 4104, Level 16, State 1, Line 2
The multi-part identifier "r.WPROJ_ID" could not be bound.
I have all tables identified; however unclear as to why it cannot be bound.
Please help.
View 4 Replies
View Related
Apr 4, 2006
if exists (select 'x' from obj where new_obj.key1 = obj.key1 and new_obj.class = obj.class)
BEGIN
set @temp_old_ref = (select obj.rowid from obj where new_obj.key1 = obj.key1 and new_obj.class = obj.class)
SET IDENTITY_INSERT new_obj ON
insert into new_obj(rid, key1, class, is_searchable, is_deleted, is_loaded, old_rid, old_ref) select rid, key1, class, is_searchable, is_deleted, is_loaded, old_rid, @temp_old_reffrom new_obj
delete from new_obj where old_ref != @temp_old_ref
END
while running it i m getting this error
Msg 4104, Level 16, State 1, Procedure mergeChanges, Line 35
The multi-part identifier "new_obj.key1" could not be bound.
Msg 4104, Level 16, State 1, Procedure mergeChanges, Line 35
The multi-part identifier "new_obj.class" could not be bound.
Msg 4104, Level 16, State 1, Procedure mergeChanges, Line 37
The multi-part identifier "new_obj.key1" could not be bound.
Msg 4104, Level 16, State 1, Procedure mergeChanges, Line 37
The multi-part identifier "new_obj.class" could not be bound.
any thoughts
View 2 Replies
View Related
Nov 7, 2007
Can anyone explain why i get the folling error.
Msg 4104, Level 16, State 1, Procedure rpt_getChildren, Line 33
The multi-part identifier "c.childID" could not be bound.
Msg 4104, Level 16, State 1, Procedure rpt_getChildren, Line 33
The multi-part identifier "c.siteID" could not be bound.
Msg 4104, Level 16, State 1, Procedure rpt_getChildren, Line 33
The multi-part identifier "c.siteID" could not be bound.
Msg 1011, Level 16, State 1, Procedure rpt_getChildren, Line 33
The correlation name 'sg' is specified multiple times in a FROM clause.
create procedure rpt_getChildren
@cmb1 as varchar(100)
AS
BEGIN
set dateformat YMD
set datefirst 7
CREATE TABLE #ChildSessions (
siteid integer null
,childid integer null
,sessionid integer null
,sun integer default 0
,mon integer default 0
,tue integer default 0
,wed integer default 0
,thr integer default 0
,fri integer default 0
,sat integer default 0)
declare @firstofweek as datetime
declare @lastofweek as datetime
select @firstofweek=cast(floor(cast(dateadd(day,(-1*datepart(dw,getdate())+1),getdate()) as float)) as datetime)
select @lastofweek=dateadd(minute,-1,dateadd(day,7,@firstofweek))
declare @myday integer
set @myday=0
while @myday<7
BEGIN
INSERT INTO #ChildSessions
SELECT
c.siteid
,c.childid
,sg.sessionid
,case @myday WHEN 1 THEN 1 ELSE 0 end
,case @myday WHEN 2 THEN 1 ELSE 0 end
,case @myday WHEN 3 THEN 1 ELSE 0 end
,case @myday WHEN 4 THEN 1 ELSE 0 end
,case @myday WHEN 5 THEN 1 ELSE 0 end
,case @myday WHEN 6 THEN 1 ELSE 0 end
,case @myday WHEN 7 THEN 1 ELSE 0 end
FROM
Child c
,sessionAttendance sa
,session s
,sessiongroup sg
INNER JOIN
SessionAttendance sa
ON c.childID = sa.childID
INNER JOIN
Session s
ON c.siteID = s.siteID
INNER JOIN
Site
ON c.siteID = s.siteID
INNER JOIN
SessionGroup sg
ON c.siteID = sg.siteID
WHERE
c.childID = sa.childid
AND c.siteid = sa.siteid
AND c.active = 1
AND c.potential = 0
AND s.identityid = sa.identityid
AND s.siteid = sa.siteid
AND sg.sessionid = s.sessionID
AND sg.siteid = s.siteid
--AND site.sitename = @cmb1
AND s.dayofweek = @myday
AND @firstofweek <= sa.dateTo
AND @lastofweek >= sa.dateFrom
SET @myday=@myday+1
END
SELECT
c.forename,
c.surname,
sg.sessionname,
--sitename,
CASE (sum(sun)) WHEN 0 THEN ' ' ELSE 'X' END as sun,
CASE (sum(mon)) WHEN 0 THEN ' ' ELSE 'X' END as mon,
CASE (sum(tue)) WHEN 0 THEN ' ' ELSE 'X' END as tue,
CASE (sum(wed)) WHEN 0 THEN ' ' ELSE 'X' END as wed,
CASE (sum(thr)) WHEN 0 THEN ' ' ELSE 'X' END as thr,
CASE (sum(fri)) WHEN 0 THEN ' ' ELSE 'X' END as fri,
CASE (sum(sat)) WHEN 0 THEN ' ' ELSE 'X' END as sat,
case when datepart(day,c.dob)<=datepart(day,getdate())
then cast((datediff(month,c.dob,getdate())/12) as varchar(3)) + ' Yr '
+ cast((datediff(month,c.dob,getdate())% 12) as varchar(2)) + ' Mnth'
when datepart(day,c.dob)>datepart(day,getdate())
then cast(((datediff(month,c.dob,getdate())-1)/12) as varchar(3)) + ' Yr '
+ cast(((datediff(month,c.dob,getdate())-1)% 12) as varchar(2)) + ' Mnth' end as Child_Age
FROM child c,sessiongroup sg, site, #childsessions cs
WHERE c.childid=cs.childid
AND c.siteid=cs.siteid
AND sg.sessionid=cs.sessionid
AND sg.siteid=cs.siteid
--AND s.sitename = @cmb1
GROUP BY c.forename,c.surname,sg.sessionname,c.dob,c.childid
ORDER BY sg.sessionname,c.forename,c.surname
DROP TABLE #ChildSessions
END
GO
View 5 Replies
View Related
Sep 7, 2007
Hi,
I have the following statement with multi-part identifier error :-
SELECT #t.vno,transact.vdesc,transact.acctno,transact.camt,transact.damt,transact.ccamt,transact.cdamt
into #main
FROM transact,(
SELECT VNO,VTYPE,TDATE,SUM(CAMT) AS SCAMT,SUM(DAMT) AS SDAMT
FROM TRANSACT
WHERE YEAR = 2007 and batchno = 5
GROUP BY VNO,VTYPE,TDATE
having sum(camt) <> sum(damt)
)as #t
WHERE (transact.YEAR = 2007)
thanks
View 4 Replies
View Related
May 16, 2008
Hi i am finding difficulty in adding updating the Last transaction Date of Materials Loaded Out.
The Master table has LoadID, LastLoadDate.
Child Table has MaterialID, LoadID, Weight1, Weight1DateTime, Weight2, Weight2DateTime
My Requirement is to update the Master.LastLoadDate field with the Highest date of the materials loaded out on different days.
I wrote the following query and it is getting me
" The multi-part identifier "#tblTemp.Mydate" could not be bound "
update table Tbl_LoadMaster set LastTransDate=(Select MAX(#tblTemp1.Mydate) as MaxDate from (
Select * from(
select Distinct Weight1DateTime as MyDate from Tbl_LoadMaterialDetails where LoadID=1 Union
select Distinct Weight2DateTime as MyDate from Tbl_LoadMaterialDetails where LoadInID=1
) #tblTemp1) #TblTemp2)
Please help me o find a solution for this situation. I am in a real hurry.
Thanks in Advance
Vineesh
View 3 Replies
View Related
Mar 5, 2008
I have the following code and I am getting the error Multi-Part identifier not found.
I know its a problem with the code highlighted in green. Can anyone help?
Select
a.Code 'Product Code',
a.Description 'Product Description',
PackSize,
NetWeight,
GrossWeight,
CubicVolume,
SupplierOwnCode,
a.SupplierCode,
b.[Name] 'Supplier Name',
e.Description 'Product Type Description',
LeadTime,
os.description,
sum(pl.QuantityOrder) 'Order With Supplier',
0 'On Order By Customer',
sum(pl.QuantityOrder) - 0 'Total On Order'
from Product a
inner join Supplier b on a.SupplierCode = b.code
inner join ProductType e on a.TypeID = e.ID
inner join PurchaseOrderLines pl on po.code = pl.PurchaseOrderCode
LEFT join PurchaseOrders po on a.code = pl.productcode
LEFT join orderstatus os on po.orderstatus = os.id
AND os.id = 2
where a.code = @ProductCode
group by
a.Code , a.Description , PackSize, NetWeight, GrossWeight,
CubicVolume, SupplierOwnCode, a.SupplierCode, b.[Name],
e.Description , LeadTime, os.description
Cheers
View 5 Replies
View Related
Mar 27, 2006
Hi,
I want to join a temporary table with a table in my stored procedure :
CREATE PROCEDURE sp_DeltaabgleichDarlehen
AS
BEGIN
SELECT Grundeinstellungen.Dat_Initialisierung, Grundeinstellungen.Dat_Jahresbeginn
INTO #temp_IniDatum
FROM Grundeinstellungen
INSERT INTO DeltaDarlStammdaten (Datum, Vertragsnummer)
SELECT ImpDarlStammdaten.Datum, ImpDarlStammdaten.Vertragsnummer
FROM ImpDarlStammdaten
WHERE ImpDarlStammdaten.Datum=#temp_IniDatum.Dat_Jahresbeginn
END
i get the error :
The multi-part identifier "#temp_IniDatum.Dat_Jahresbeginn" could not be boundfor example
What is the problem? and how can i solve this?
thank you
Jupp
View 4 Replies
View Related