Showing posts with label causes. Show all posts
Showing posts with label causes. Show all posts

Friday, March 9, 2012

Invalid Column Name

Hi the following SP that causes an error.

CREATE PROCEDURE GetInfo
(
@.MinPriceint=0,
@.MaxPriceint=9999999999,
@.TypeHomenvarchar(50)=NULL,
@.Locationnvarchar(100)=NULL

)
AS

Declare @.strSql nvarchar(255)
Set @.strSql="Select * from table WHERE "
Set @.strSql=@.strSql + 'Price BETWEEN ' + CONVERT(nvarchar(20),@.MinPrice) + ' and ' + CONVERT(nvarchar(20),@.MaxPrice )

If @.TypeHome != "No Preference"
Set @.strSql=@.strSql + ' and Type = ''' + @.TypeHome+ ''''

If @.Location != "No Preference"
Set @.strSql=@.strSql + ' and City = ''' + @.Location+ ''''

Set @.strSql=@.strSql + ' and IDX = ''Y'' ORDER BY Price'
Exec(@.strSql)
GO

The Error I get is:
"Error 207: Invalide Column Name 'Select * from table WHERE'
Invalid Column Name 'No Preference'
Invalid Column Name 'No Preference'

I have checked the table and the columns do exist, spelled correctly and caps are all the same. Also, this same SP in another table works just fine.

What is causing this error?

Thanks in advance!change your double quotes to single quotes when you assign a string to a variable.
sample : you should say set @.var = 'value' and not set @.var= "value "

hth

Wednesday, March 7, 2012

Intra-query parallelism causes deadlock

Has anyone seen the following message and if so how did you go about resolving the problem?

Server: Msg 8650, Level 13, State 1, Line 20
Intra-query parallelism caused your server command (process ID #15) to deadlock. Rerun the query without intra-query parallelism by using the query hint option (maxdop 1).Can anyone give me a low down on Intra-query parallelism and why a quad server will get this error?
Jim

Originally posted by Deddens
Has anyone seen the following message and if so how did you go about resolving the problem?

Server: Msg 8650, Level 13, State 1, Line 20
Intra-query parallelism caused your server command (process ID #15) to deadlock. Rerun the query without intra-query parallelism by using the query hint option (maxdop 1).