Can anyone see why I'm getting this error The column prefix 'dbo.PropertyForRentLocalized' does not match with a table name or alias name used in the query.

 Could someone please explain the likely root cause of this error.Thanks, andy.

 

Server: Msg 107, Level 16, State 3, Line 16
The column prefix 'dbo.PropertyForRentLocalized' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 16
The column prefix 'dbo.PropertyForRentLocalized' does not match with a table name or alias name used in the query.
Server: Msg 107, Level 16, State 1, Line 16
The column prefix 'dbo.PropertyForRentLocalized' does not match with a table name or alias name used in the query.

 

CREATE PROCEDURE [dbo].[sp_getpropertiesbyquicksearchcriteria]
    @categoryid int = NULL,
    @forsale bit = NULL,
    @forrent bit = NULL,
    @cityid int = NULL,
    @typeid int = NULL,
    @districtid int = NULL,
    @minbeds int= NULL,
    @maxbeds int= NULL,
    @baths int=NULL,
    @areasqm int = NULL,
    @pricemin int= NULL,
    @pricemax int= NULL,
    @newconstruction bit= NULL,
    @newlylisted bit= NULL,
    @investmentopportunity bit= NULL,
    @culture nvarchar(50) = NULL
AS

DECLARE    @sql  nvarchar(4000),
                @paramlist  nvarchar(4000)

SELECT @sql =
'SELECT    dbo.Property.propertyId, dbo.Property.userId, dbo.Property.status, dbo.Property.name, dbo.Property.propertyCategoryId, dbo.Property.propertyTypeId, dbo.Property.dateAdded, dbo.Property.dateVerified, dbo.Property.streetId, dbo.Property.districtId,
                  dbo.Property.cityId, dbo.Property.whenCompleted, dbo.Property.finishId, dbo.Property.conditionId, dbo.Property.areaSqM, dbo.Property.totalRooms, dbo.Property.bedrooms, dbo.Property.bathrooms, dbo.Property.lotSize, dbo.Property.ceilingHeight,
                  dbo.Property.storiesOfBuilding, dbo.Property.floorNumber, dbo.Property.featureGarage, dbo.Property.featureView, dbo.Property.featureSecurity, dbo.Property.featurePool, dbo.Property.featureSpa, dbo.Property.featureLandPlot,
                  dbo.Property.featurePrivateEntrance, dbo.Property.featureAC, dbo.Property.featureHeating, dbo.Property.featureBalcony, dbo.Property.featureFireplace, dbo.Property.featureTelephone, dbo.Property.featureInternet, dbo.Property.featureSatellite,
                  dbo.Property.featureElevator, dbo.Property.walkingDistanceSea, dbo.Property.walkingDistanceLake, dbo.Property.walkingDistancePark, dbo.Property.walkingDistanceSeafront, dbo.Property.walkingDistanceBeachfront, dbo.Property.metroId,
                  dbo.Property.latitude, dbo.Property.longitude, dbo.PropertyForRentLocalized.propertyForRentId, dbo.PropertyForRentLocalized.culture AS propertyforrentlocalizedculture, dbo.PropertyForRentLocalized.leasePreferences, dbo.PropertyForRent.propertyForRentId AS propertyforrentid,
                  dbo.PropertyForRent.propertyId AS propertyforrentpropertid, dbo.PropertyForRent.dateAdded AS propertyforrentdateadded, dbo.PropertyForRent.pricePerSqM, dbo.PropertyForRent.pricePerMonth, dbo.PropertyForRent.pricePerDay, dbo.PropertyForRent.ifGoodForOffice,
                  dbo.PropertyForRent.ifLuxury, dbo.PropertyForRent.ifOnBusyStreet, dbo.PropertyForRent.contactPerson, dbo.PropertyForRent.contactCompany, dbo.PropertyForRent.contactPhone, dbo.PropertyForRent.contactMobile, dbo.PropertyForRent.contactEmail,
                  dbo.PropertyForRent.contactSmsOk, dbo.PropertyForRent.contactNotes

FROM         dbo.Property INNER JOIN
                      dbo.PropertyLocalized ON dbo.Property.propertyId = dbo.PropertyLocalized.propertyId AND (dbo.PropertyLocalized.culture = @culture) LEFT OUTER JOIN
                      dbo.PropertyForRent ON dbo.Property.propertyId = dbo.PropertyForRent.propertyId LEFT OUTER JOIN
                      dbo.PropertyForSale ON dbo.Property.propertyId = dbo.PropertyForSale.propertyId LEFT OUTER JOIN
                      dbo.DistrictLocalized ON dbo.Property.districtId = dbo.DistrictLocalized.districtId AND (dbo.DistrictLocalized.culture = @culture) LEFT OUTER JOIN
                      dbo.StreetLocalized ON dbo.Property.streetId = dbo.StreetLocalized.streetId AND (dbo.StreetLocalized.culture = @culture) LEFT OUTER JOIN
                      dbo.CityLocalized ON dbo.Property.cityId = dbo.CityLocalized.cityId AND (dbo.CityLocalized.culture = @culture) LEFT OUTER JOIN
                      dbo.PropertyTypeLocalized ON dbo.Property.propertyTypeId = dbo.PropertyTypeLocalized.propertyTypeId AND (dbo.PropertyTypeLocalized.culture = @culture) LEFT OUTER JOIN
                      dbo.PropertyCategoryLocalized ON dbo.Property.propertyCategoryId = dbo.PropertyCategoryLocalized.propertyCategoryId AND (dbo.PropertyCategoryLocalized.culture = @culture) LEFT OUTER JOIN
                      dbo.Finish ON dbo.Property.finishId = dbo.Finish.finishId AND (dbo.Finish.culture = @culture) LEFT OUTER JOIN
                      dbo.Condition ON dbo.Property.conditionId = dbo.Condition.conditionId AND (dbo.Condition.culture = @culture)'

IF @forsale IS NOT NULL                                           
   SELECT @sql = @sql + ' AND LEFT OUTER JOIN
                      dbo.PropertyForSale ON dbo.Property.propertyId = dbo.PropertyForSale.propertyId'
IF @forrent IS NOT NULL                                           
   SELECT @sql = @sql + ' AND LEFT OUTER JOIN
                      dbo.PropertyForRent ON dbo.Property.propertyId = dbo.PropertyForRent.propertyId'
IF @categoryid IS NOT NULL                                           
   SELECT @sql = @sql + '  WHERE (dbo.Property.status = 1) AND (dbo.Property.propertyCategoryId = @propertycategoryid) '
IF @cityid IS NOT NULL                                           
   SELECT @sql = @sql + ' WHERE (dbo.Property.cityId = @cityId) '
IF @typeid IS NOT NULL                                           
   SELECT @sql = @sql + ' WHERE (dbo.Property.propertyTypeId = @propertyTypeId) '
IF @districtid IS NOT NULL                                           
   SELECT @sql = @sql + ' WHERE (dbo.Property.districtId = @districtId) '
IF @minbeds IS NOT NULL                                           
   SELECT @sql = @sql + '  WHERE (dbo.Property.bedrooms >= @minbeds) '
IF @maxbeds IS NOT NULL                                           
   SELECT @sql = @sql + ' WHERE (dbo.Property.bedrooms <= @maxbeds) '
IF @baths IS NOT NULL                                           
   SELECT @sql = @sql + ' WHERE (dbo.Property.bathrooms = @bathrooms)'
IF @areasqm IS NOT NULL                                           
   SELECT @sql = @sql + '  WHERE (dbo.Property.areaSqM = @areaSqM)'
IF @pricemin IS NOT NULL                                           
   SELECT @sql = @sql + '  WHERE (dbo.PropertyForRent.pricePerSqM >= @pricemin) AND (dbo.PropertyForSale.PricePerSqM >=@pricemin '
IF @pricemax IS NOT NULL                                           
   SELECT @sql = @sql + ' WHERE (dbo.PropertyForRent.pricePerSqM <= @pricemax) AND (dbo.PropertyForSale.PricePerSqM <= @pricemax'
IF @newconstruction IS NOT NULL                                           
   SELECT @sql = @sql + ''
IF @newlylisted IS NOT NULL                                           
   SELECT @sql = @sql + ''
IF @investmentopportunity IS NOT NULL                                           
   SELECT @sql = @sql + ''
If @culture IS NOT NULL
   SELECT @sql = @sql + ''

SELECT @paramlist ='    @categoryid int,
            @forsale bit,
            @forrent bit,
            @cityid int,
            @typeid int ,
            @districtid int,
            @minbeds int,
            @maxbeds int,
            @baths int,
            @areasqm int,
            @pricemin int,
            @pricemax int,
            @newconstruction bit,
            @newlylisted bit,
            @investmentopportunity bit,
            @culture nvarchar(50) '

EXEC sp_executesql     @sql, @paramlist, @categoryid, @forsale, @forrent, @cityid, @typeid,@districtid, @minbeds, @maxbeds,  @baths, @areasqm, @pricemin, @pricemax, @newconstruction, @newlylisted, @investmentopportunity, @culture
GO
 

 

 


Current project: Cycle round the world
0
ajw
7/14/2008 6:17:54 AM
asp.net.sql-datasource 29906 articles. 0 followers. Follow

7 Replies
880 Views

Similar Articles

[PageSpeed] 4

Meaning of that error is, when you are referencing a columnname with some prefix, that prefix must be the tablename or aliasname of that table. but you are using 'dbo.PropertyForRentLocalized"  which is neither tablename nor aliasname.

 

Eg:  

          select table1.name from table1    --------->   ok

          select a.name from table1  a  --------->   ok

                select b.name from table1    --------->   Wrong. because b is niether tablename like table1 nor aliasname like a in above example.

i think you understand what i am saying. replace that prefix with correct table name or you may forgot to add that table in innerjons

 


Give a man a fish and you feed him for a day. Teach a man to fish and you feed him forever.
0
ramireddyindia
7/14/2008 8:48:31 AM

 Hi,

 I  updated the query but now I'm getting:

Server: Msg 170, Level 15, State 1, Line 54
Line 54: Incorrect syntax near '@culture'.

Thanks for your help.

 CREATE PROCEDURE [dbo].[Search_QuickSearch]
    @culture nvarchar(50),
    @propertyCategoryId int = NULL,
    @forSale bit = NULL,
    @forRent bit = NULL,
    @cityId int = NULL,
    @propertyTypeId int = NULL,
    @districtId int = NULL,
    @minBedrooms int = NULL,
    @maxBedrooms int = NULL,
    @minBathrooms int = NULL,
    @maxBathrooms int = NULL,
    @minAreaSqM int = NULL,
    @minSalePrice int = NULL,
    @maxSalePrice int = NULL,
    @minRentPrice int = NULL,
    @maxRentPrice int = NULL,
    @newConstruction bit = NULL,
    @dateListedSince datetime = NULL,
    @investmentOpportunity bit = NULL
AS

DECLARE @sql AS nvarchar(4000)
DECLARE @paramlist AS nvarchar(4000)

SELECT @sql =
'SELECT dbo.PropertyId,
    dbo.Property.name, dbo.Property.dateAdded, dbo.Property.whenCompleted, dbo.Property.areaSqM,
    dbo.Property.totalRooms, dbo.Property.bedrooms, dbo.Property.bathrooms, dbo.Property.lotSize,
    dbo.Property.ceilingHeight, dbo.Property.storiesOfBuilding, dbo.Property.floorNumber,
    dbo.Property.featureGarage, dbo.Property.featureView, dbo.Property.featureSecurity,
    dbo.Property.featurePool, dbo.Property.featureSpa, dbo.Property.featureLandPlot,
    dbo.Property.featurePrivateEntrance, dbo.Property.featureAC, dbo.Property.featureHeating,
    dbo.Property.featureBalcony, dbo.Property.featureFireplace, dbo.Property.featureTelephone,
    dbo.Property.featureInternet, dbo.Property.featureSatellite, dbo.Property.featureElevator,
    dbo.Property.walkingDistanceSea, dbo.Property.walkingDistanceLake, dbo.Property.walkingDistancePark,
    dbo.Property.walkingDistanceSeafront, dbo.Property.walkingDistanceBeachfront,
    dbo.PropertyLocalized.description, dbo.PropertyLocalized.address, dbo.PropertyCategoryLocalized.title AS categoryName,
    dbo.PropertyTypeLocalized.title AS typeName, dbo.CityLocalized.name AS cityName, dbo.DistrictLocalized.name AS districtName,
    dbo.StreetLocalized.name AS streetName, dbo.Condition.name AS conditionName, dbo.Finish.name AS finishName,
    dbo.PropertyForSale.propertyForSaleId, dbo.PropertyForSale.pricePerSqM AS salePricePerSqM,
    dbo.PropertyForSale.priceTotal AS salePriceTotal, dbo.PropertyForSale.ifCurrentlyRented,
    dbo.PropertyForSale.ifCurrentlyRentedPrice, dbo.PropertyForSale.ifGoodForOffice AS saleIfGoodForOffice,
    dbo.PropertyForSale.ifGoodForInvestment AS saleIfGoodForInvestment, dbo.PropertyForSale.ifLuxury AS saleIfLuxury,
    dbo.PropertyForSale.contactPerson AS saleContactPerson, dbo.PropertyForSale.contactCompany AS saleContactCompany,
    dbo.PropertyForSale.contactPhone AS saleContactPhone, dbo.PropertyForSale.contactMobile AS saleContactMobile,
    dbo.PropertyForSale.contactEmail AS saleContactEmail, dbo.PropertyForSale.contactSmsOk AS saleContactSmsOk,
    dbo.PropertyForSale.contactNotes AS saleContactSmsOk, dbo.PropertyForRent.pricePerSqM AS rentPricePerSqM,
    dbo.PropertyForRent.pricePerMonth AS rentPricePerMonth, dbo.PropertyForRent.pricePerDay AS rentPricePerDay,
    dbo.PropertyForRent.ifGoodForOffice AS rentIfGoodForOffice, dbo.PropertyForRent.ifLuxury AS rentIfLuxury,
    dbo.PropertyForRent.ifOnBusyStreet AS rentIfOnBusyStreet, dbo.PropertyForRent.contactPerson AS rentContactPerson,
    dbo.PropertyForRent.contactCompany AS rentContactCompany, dbo.PropertyForRent.contactPhone AS rentContactPhone,
    dbo.PropertyForRent.contactMobile AS rentContactMobile, dbo.PropertyForRent.contactEmail AS rentContactEmail,
    dbo.PropertyForRent.contactSmsOk AS rentContactSmsOk, dbo.PropertyForRent.contactNotes AS rentContactNotes,
    dbo.PropertyForRentLocalized.leasePreferences
FROM  dbo.Property INNER JOIN
    dbo.PropertyLocalized ON dbo.Property.propertyId = dbo.PropertyLocalized.propertyId AND (dbo.PropertyLocalized.culture = @culture) '

IF (@forRent = 1)
    SELECT @sql = @sql + 'INNER JOIN '
ELSE SELECT @sql = @sql + 'LEFT OUTER JOIN '

SELECT @sql = @sql +
    'dbo.PropertyForRent ON dbo.Property.propertyId = dbo.PropertyForRent.propertyId LEFT OUTER JOIN
    dbo.PropertyForRentLocalized ON dbo.PropertyForRent.propertyForRentId = dbo.PropertyForRent.propertyForRentId AND dbo.PropertyForRent.culture = @culture '
   
IF (@forSale = 1)
    SELECT @sql = @sql + 'INNER JOIN '
ELSE SELECT @sql = @sql + 'LEFT OUTER JOIN '

SELECT @sql = @sql +
    'dbo.PropertyForSale ON dbo.Property.propertyId = dbo.PropertyForSale.propertyId LEFT OUTER JOIN
    dbo.DistrictLocalized ON dbo.Property.districtId = dbo.DistrictLocalized.districtId AND (dbo.DistrictLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.StreetLocalized ON dbo.Property.streetId = dbo.StreetLocalized.streetId AND (dbo.StreetLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.CityLocalized ON dbo.Property.cityId = dbo.CityLocalized.cityId AND (dbo.CityLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.PropertyTypeLocalized ON dbo.Property.propertyTypeId = dbo.PropertyTypeLocalized.propertyTypeId AND (dbo.PropertyTypeLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.PropertyCategoryLocalized ON dbo.Property.propertyCategoryId = dbo.PropertyCategoryLocalized.propertyCategoryId AND (dbo.PropertyCategoryLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.Finish ON dbo.Property.finishId = dbo.Finish.finishId AND (dbo.Finish.culture = @culture) LEFT OUTER JOIN
    dbo.Condition ON dbo.Property.conditionId = dbo.Condition.conditionId AND (dbo.Condition.culture = @culture)
    WHERE (dbo.Property.status = 4)
    AND (dbo.Property.propertyCategoryId = @propertyCategoryId OR @propertyCategoryId IS NULL)
    AND (dbo.Property.cityId = @cityId OR @cityId IS NULL)
    AND (dbo.Property.propertyTypeId = @propertyTypeId OR @propertyTypeId IS NULL)
    AND (dbo.Property.districtId = @districtId OR @districtId IS NULL)
    AND (dbo.Property.bedrooms >= @minBedrooms OR @minBedrooms IS NULL)
    AND (dbo.Property.bedrooms <= @maxBedrooms OR @minBedrooms IS NULL)
    AND (dbo.Property.bathrooms >= @minBathrooms OR @minBathrooms IS NULL)
    AND (dbo.Property.bathrooms <= @maxBathrooms OR @maxBathrooms IS NULL)
    AND (dbo.PropertyForSale.priceTotal <= @minSalePrice OR @minSalePrice IS NULL)
    AND (dbo.PropertyForSale.priceTotal >= @maxSalePrice OR @maxSalePrice IS NULL)
    AND (dbo.PropertyForRent.pricePerMonth <= @minRentPrice OR @minRentPrice IS NULL)
    AND (dbo.PropertyForRent.pricePerMonth >= @maxRentPrice OR @maxRentPrice IS NULL)
    AND (dbo.Property.dateVerified >= @dateListedSince OR @dateListedSince IS NULL)
    AND (dbo.PropertyForSale.ifGoodForInvestment = @investmentOpportunity OR @investmentOpportunity IS NULL OR @investmentOpportunity = 0)'

SELECT @paramlist =
    '@culture nvarchar(50),
    @propertyCategoryId int,
    @forSale bit,
    @forRent bit,
    @cityId int,
    @propertyTypeId int,
    @districtId int,
    @minBedrooms int,
    @maxBedrooms int,
    @minBathrooms int,
    @maxBathrooms int,
    @minAreaSqM int,
    @minSalePrice int,
    @maxSalePrice int,
    @minRentPrice int,
    @maxRentPrice int,
    @newConstruction bit,
    @dateListedSince datetime,
    @investmentOpportunity bit'

EXEC sp_executesql
    @sql,
    @paramlist,
    @culture,
    @propertyCategoryId,
    @forSale,
    @forRent,
    @cityId,
    @propertyTypeId,
    @districtId,
    @minBedrooms,
    @maxBedrooms,
    @minBathrooms,
    @maxBathrooms,
    @minAreaSqM,
    @minSalePrice,
    @maxSalePrice,
    @minRentPrice,
    @maxRentPrice,
    @newConstruction,
    @dateListedSince,
    @investmentOpportunity
GO
 


Current project: Cycle round the world
0
ajw
7/14/2008 9:49:20 AM

Its compiling successfully. but when running you are getting this error. it is very difficult whats the error from outside. so what i would suggest is add a print statement before the last line in stored procedure

ajw:
EXEC sp_executesql
    @sql,
    @paramlist,
    @culture,
    @propertyCategoryId,
    @forSale,
    @forRent,
    @cityId,
    @propertyTypeId,
    @districtId,
    @minBedrooms,
    @maxBedrooms,
    @minBathrooms,
    @maxBathrooms,
    @minAreaSqM,
    @minSalePrice,
    @maxSalePrice,
    @minRentPrice,
    @maxRentPrice,
    @newConstruction,
    @dateListedSince,
    @investmentOpportunity
GO

before the above line add a statement print @sql

then give some parameters and manually run that procedure from your sql environment, then see in the messages section, what is the @sql value that you got, take that query and run it. observe that query. I think mostly you may get what's your error. if not post that query you got into that @sql variable when you run that procedure.,

 


Give a man a fish and you feed him for a day. Teach a man to fish and you feed him forever.
0
ramireddyindia
7/14/2008 10:04:19 AM

 thanks for the help.I'm using sql 2000

1. how do I give it some parameters.

2. how do I manually run the procedure from sql environment - is query analyzer, create to new window and execute ok?

 I assume above it ok I get:

SELECT dbo.PropertyId,
    dbo.Property.name, dbo.Property.dateAdded, dbo.Property.whenCompleted, dbo.Property.areaSqM,
    dbo.Property.totalRooms, dbo.Property.bedrooms, dbo.Property.bathrooms, dbo.Property.lotSize,
    dbo.Property.ceilingHeight, dbo.Property.storiesOfBuilding, dbo.Property.floorNumber,
    dbo.Property.featureGarage, dbo.Property.featureView, dbo.Property.featureSecurity,
    dbo.Property.featurePool, dbo.Property.featureSpa, dbo.Property.featureLandPlot,
    dbo.Property.featurePrivateEntrance, dbo.Property.featureAC, dbo.Property.featureHeating,
    dbo.Property.featureBalcony, dbo.Property.featureFireplace, dbo.Property.featureTelephone,
    dbo.Property.featureInternet, dbo.Property.featureSatellite, dbo.Property.featureElevator,
    dbo.Property.walkingDistanceSea, dbo.Property.walkingDistanceLake, dbo.Property.walkingDistancePark,
    dbo.Property.walkingDistanceSeafront, dbo.Property.walkingDistanceBeachfront,
    dbo.PropertyLocalized.description, dbo.PropertyLocalized.address, dbo.PropertyCategoryLocalized.title AS categoryName,
    dbo.PropertyTypeLocalized.title AS typeName, dbo.CityLocalized.name AS cityName, dbo.DistrictLocalized.name AS districtName,
    dbo.StreetLocalized.name AS streetName, dbo.Condition.name AS conditionName, dbo.Finish.name AS finishName,
    dbo.PropertyForSale.propertyForSaleId, dbo.PropertyForSale.pricePerSqM AS salePricePerSqM,
    dbo.PropertyForSale.priceTotal AS salePriceTotal, dbo.PropertyForSale.ifCurrentlyRented,
    dbo.PropertyForSale.ifCurrentlyRentedPrice, dbo.PropertyForSale.ifGoodForOffice AS saleIfGoodForOffice,
    dbo.PropertyForSale.ifGoodForInvestment AS saleIfGoodForInvestment, dbo.PropertyForSale.ifLuxury AS saleIfLuxury,
    dbo.PropertyForSale.contactPerson AS saleContactPerson, dbo.PropertyForSale.contactCompany AS saleContactCompany,
    dbo.PropertyForSale.contactPhone AS saleContactPhone, dbo.PropertyForSale.contactMobile AS saleContactMobile,
    dbo.PropertyForSale.contactEmail AS saleContactEmail, dbo.PropertyForSale.contactSmsOk AS saleContactSmsOk,
    dbo.PropertyForSale.contactNotes AS saleContactSmsOk, dbo.PropertyForRent.pricePerSqM AS rentPricePerSqM,
    dbo.PropertyForRent.pricePerMonth AS rentPricePerMonth, dbo.PropertyForRent.pricePerDay AS rentPricePerDay,
    dbo.PropertyForRent.ifGoodForOffice AS rentIfGoodForOffice, dbo.PropertyForRent.ifLuxury AS rentIfLuxury,
    dbo.PropertyForRent.ifOnBusyStreet AS rentIfOnBusyStreet, dbo.PropertyForRent.contactPerson AS rentContactPerson,
    dbo.PropertyForRent.contactCompany AS rentContactCompany, dbo.PropertyForRent.contactPhone AS rentContactPhone,
    dbo.PropertyForRent.contactMobile AS rentContactMobile, dbo.PropertyForRent.contactEmail AS rentContactEmail,
    dbo.PropertyForRent.contactSmsOk AS rentContactSmsOk, dbo.PropertyForRent.contactNotes AS rentContactNotes,
    dbo.PropertyForRentLocalized.leasePreferences
FROM  dbo.Property INNER JOIN
    dbo.PropertyLocalized ON dbo.Property.propertyId = dbo.PropertyLocalized.propertyId AND (dbo.PropertyLocalized.culture = @culture) LEFT OUTER JOIN dbo.PropertyForRent ON dbo.Property.propertyId = dbo.PropertyForRent.propertyId LEFT OUTER JOIN
    dbo.PropertyForRentLocalized ON dbo.PropertyForRent.propertyForRentId = dbo.PropertyForRent.propertyForRentId AND dbo.PropertyForRent.culture = @culture LEFT OUTER JOIN dbo.PropertyForSale ON dbo.Property.propertyId = dbo.PropertyForSale.propertyId LEFT OUTER JOIN
    dbo.DistrictLocalized ON dbo.Property.districtId = dbo.DistrictLocalized.districtId AND (dbo.DistrictLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.StreetLocalized ON dbo.Property.streetId = dbo.StreetLocalized.streetId AND (dbo.StreetLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.CityLocalized ON dbo.Property.cityId = dbo.CityLocalized.cityId AND (dbo.CityLocalized.culture = @culture) LEFT OUTER JOIN
    dbo.PropertyTypeLocalized ON dbo.Property.propertyTypeId = dbo.PropertyTypeLocalized.propertyTypeId AND (dbo.PropertyTypeLocalized.culture = @culture
Server: Msg 170, Level 15, State 1, Line 54
Line 54: Incorrect syntax near '@culture'.

 " post that query you got into that @sql variable when you run that procedure.,"

can you please explain how to do this. Thanks

Andy


Current project: Cycle round the world
0
ajw
7/14/2008 11:29:11 AM

It seems to be you missed an right brace after the statement.

ajw:
(dbo.PropertyTypeLocalized.culture = @culture

put that brace.

 (dbo.PropertyTypeLocalized.culture = @culture)


Give a man a fish and you feed him for a day. Teach a man to fish and you feed him forever.
0
ramireddyindia
7/14/2008 11:33:36 AM

 The brace exists already.


Current project: Cycle round the world
0
ajw
7/14/2008 11:45:33 AM

 any ideas?


Current project: Cycle round the world
0
ajw
7/14/2008 4:15:34 PM
Reply:

Similar Artilces:

The column prefix 'g' does not match with a table name or alias name used in the query
Still dont work does anybody can help?.. I only changed the connection string on the web.config.. like user and database name .. nothing else Installing DotNetNuke Version: 03.00.12 Current Settings Default Provider SqlDataProvider Connection String Server=(local);Database=DotNetNuke3012;uid=dotnetnuke;pwd=****; ..NET Framework Version 1.1.4322.2032 Windows User DREAMSERVER2\ASPNET Host Name dreamserver2 Installation Status Report 00:00:00.140 - Installing Version: 3.0.12 00:00:00.140 - Installing Script: DotNetNuke.SetUp.SqlDataProvider 00:00:0...

The column prefix 'g' does not match with a table name or alias name used in the query.
Hello, does anyone knows that, I have this problem in 3 websites, the others .. runs ok WIN 2000 - SQL 2000 The column prefix 'g' does not match with a table name or alias name used in the query. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: The column prefix 'g' does not match with a table name or alias name used in the query. Source Error: An unhandled exception was...

Correlated Subquery
I have data in a table (@Outer) that I am matching to a lookup table (@Inner) which contains multiple "matches" where nulls can match any value. By sorting the inner table and grabbing the top record, I find the "best" match. I know the sort and the null matches work but I don't understand why the correlated sub query below doesn't understand that the OJ prefix refers to the outer table.DECLARE @Outer TABLE ( OuterID int IDENTITY (1, 1) NOT NULL, MethodID int NULL, CompID int NULL, FormID int NULL, InnerID int NULL ) INSERT @Outer VALU...

getting the error: Cannot insert the value NULL into column 'name', table 'InterGlobe.dbo.IG_Admin'; column does not allow nulls. INSERT fails. The statement has been terminated.
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %> <script runat="server">   private void CrLogin_Click(object source, EventArgs e) {   try { //Response.Write("hello"); SqlDataSource2.Insert(); // Response.Redirect("logincreated.aspx"); } catch(Exception ex) { Response.Write(ex.Message); }   } </script>       <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">       &nbsp;<a...

SqlBulkCopy: the locale id '0' of the source column '<column name> ' and the locale id '1033' of the destination column '<column name>' do not match.
Hi, I am using the sqlbulkcopy object to transfer large amount of data from one SQL server to Other. The code look like this.. SqlDataReader readerSrc = null;SqlBulkCopy bulkCopy = new SqlBulkCopy(connDest);//Prepare Destination Table.SqlCommand cmdDelete = new SqlCommand("DELETE FROM " + destTableName, connDest);//Set the sqlcommand textSqlCommand cmdGet = new SqlCommand("SELECT * FROM " + srcTableName, connSrc);//Open source connection.connSrc.Open();//Open destination connection.connDest.Open();int delete = cmdDelete.ExecuteNonQuery();//Get the data.readerSrc = cmdGet.ExecuteRead...

SQL Msg 107 Error... The column prefix does not match with a table name or alias name used in the query.
Can someone please answer a problem that I've run into.  I know that it's probably something stupid.  I keep getting this error:Server: Msg 107, Level 16, State 3, Line 1The column prefix 'vFirstTimeEntered' does not match with a table name or alias name used in the query.Here is my query:-----------------------------------------------------------------Update  TimeSheetSectionSet TimesheetSection.SECSTARTDT = vFirstTimeEntered.schlstuidWhere timesheetsection.schlstuid = vFirstTimeEntered.schlstuid AND timesheetsection.sectionid = vFirstTimeEntered.sectionid AND&...

Can you use 'Pause' or 'Sleep' in SQL query?
 Can you use 'Pause' or 'Sleep' in SQL query?Success comes to those who prepare well and put in effort. Hi, can you explain it brieflyWith LuvDhanaDont forget to mark as answer if my reply helped you...  I seem its not possible in sql server although you can rotate a loop into stored procedure for delay but in sql query its not possibleShah Dharnendra GSr.Analyst Programmer,GTL-Ahmedabad Hi robinwilliams, You can try the "waitfor " sql statement. waitfor would block the execution of a batch, stored procedure, or transaction until a specified tim...

Error-Procedure 'SP Name' expects parameter '@Name', which was not supplied.
 I used grid view to delete one row.In that time i got the error like "Procedure 'SP Name' expects parameter '@Name', which was not supplied". My code is :protected void dgProject_RowDeleting(object sender, GridViewDeleteEventArgs e) {GridViewRow row = dgProject.Rows[e.RowIndex]; string a = row.Cells[1].Text;string b = row.Cells[2].Text; SqlDataSource1.ConnectionString = MyDataBase;SqlDataSource1.DeleteCommandType = SqlDataSourceCommandType.StoredProcedure; SqlDataSource1.DeleteCommand = "SP Name";SqlDataSource1.DeleteParameters.Add("Na...

''''''''''''''''''''
Name: haznen Email: haznenatyahoodotcom Product: Gran Paradiso Alpha 8 Summary: '''''''''''''''''''' Comments: '''''''''''''''''''''''''''''''''''' Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a1) Gecko/20061204 UGES/1.7.2.0 GranParadiso/3.0a1 From URL: http://www.mozilla.org/projects/granparadiso/ Note to readers: Hendrix gives...

How to solve error : Column 'Column' does not belong to table 'Table' ? Code attached
Hello    I have a dataset which is successfully being filled. However whenever i try    to access a givewn row of one of the tables in the dataset i get the error    "Column 'ContactId' does not belong to table 'SalesAgent'"    Except that it does and if i use an ordinal reference i can access the value    of the column. If i print the schema sure enough the column is called    ContactId. I have also noticed that if i hover the cursor over the    contactrow i can ac...

SQL query returns 'No column name' as a column heading
 hi,I'm trying to execute this query in SQL Server 2005 Express Edition, the problem is in the column heading of the result for the majorName fieldSELECT studentID,fname,mname,lname,familyName,gpa ,(SELECT majorName AS major FROM major WHERE majorID=(SELECT majorID FROM studentmajorWHERE studentID='0000000'))FROM student WHERE studentID='0000000'; Why the result of this query returns 'No column name' as a label for the majorName field? I use the AS clause to allows the column to be named, the column heading of the result table still 'No column name&...

getting error as Type 'AjaxControlToolkit.MaskedEditExtender' does not have a public property named 'UserTimeFormat'.
Dear All, i am using asp.net 2.0 , C# and ajax1.0 i am getting this error Type 'AjaxControlToolkit.MaskedEditExtender' does not have a public property named 'UserTimeFormat'. while i load the form on live server but this error i am not getting on test server i have register ajaxtoolkit in the form only as  <%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajaxToolkit" %> and using it as  <ajaxToolkit:MaskedEditExtender ID="MaskedEditExtender1" runat="server" Ena...

'''''
Name: mario Email: ramar17atfastwebnetdotit Product: Gran Paradiso Alpha 2 Summary: ''''' Comments: K: Browser Details: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9a2) Gecko/20070206 GranParadiso/3.0a2 ...

Problem: The type 'typename' exists in both 'dll-name-1' and 'dll-name-2'
Hi at all!For some strange reason I sometimes (not always) get the following compilation error when starting my ASP.net project:Server Error in '/' Application. Compilation Error Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately. Compiler Error Message: CS0433: The type 'ASP.formscontrols_worker_it_ascx' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0....

Web resources about - Can anyone see why I'm getting this error The column prefix 'dbo.PropertyForRentLocalized' does not match with a table name or alias name used in the query. - asp.net.sql-datasource

Resources last updated: 1/3/2016 10:29:15 AM