Home All Groups Group Topic Archive Search About

Query with user-define function John Bell

Author
16 Sep 2005 1:30 PM
Helen
Yes!! It works. But just a point. In the [Index] column I have both strings
and numbers. When I query [Index]=AA there is an error: Invalid column name
'AA'
Any more suggestion?

Thank you
Helen

Show quote
"John Bell" wrote:

> Hi
>
> Maybe
>
> CREATE TABLE foo ( [index] int not null identity(1,1), a int, b int, c
> varchar(10) )
> INSERT INTO Foo ( a, b, c ) SELECT 5,9,'a+@q+3*b'
>
> DECLARE @sql VARCHAR(255)
> SELECT @sql = 'DECLARE @q int SET @q=7 SELECT a,b,' + c+ '  FROM dbo.foo
> where [Index]=1'
> FROM dbo.foo where [Index]=1
> EXEC(@sql)
>
> John

Author
16 Sep 2005 2:29 PM
Perayu
[Index] = 'AA'.

Perayu


Show quote
"Helen" <He***@discussions.microsoft.com> wrote in message
news:A76F8AD0-7065-4968-ADA5-9E957DD7949D@microsoft.com...
> Yes!! It works. But just a point. In the [Index] column I have both
> strings
> and numbers. When I query [Index]=AA there is an error: Invalid column
> name
> 'AA'
> Any more suggestion?
>
> Thank you
> Helen
>
> "John Bell" wrote:
>
>> Hi
>>
>> Maybe
>>
>> CREATE TABLE foo ( [index] int not null identity(1,1), a int, b int, c
>> varchar(10) )
>> INSERT INTO Foo ( a, b, c ) SELECT 5,9,'a+@q+3*b'
>>
>> DECLARE @sql VARCHAR(255)
>> SELECT @sql = 'DECLARE @q int SET @q=7 SELECT a,b,' + c+ '  FROM dbo.foo
>> where [Index]=1'
>> FROM dbo.foo where [Index]=1
>> EXEC(@sql)
>>
>> John
>

AddThis Social Bookmark Button