Showing posts with label words. Show all posts
Showing posts with label words. Show all posts

Wednesday, March 7, 2012

How to find formula column from a table programmatically?

Hi,

I'm on SQL Server 2000, say, I have a table named [orders], how I find
if there is any column which has a formula in it? In other words, how
to identify formula column programmatically? I've looked at
information_schema.columns view for clue but to no avail.

Thanks.Thanks, John, yes, I got it with a slight twist, which might have been
intended by you. In the WHERE clause I ensures that COLUMNPROPERTY(
id ,name, 'ISComputed') is true. Also, since ComputedColumn is
introduced in SQL 2000, I make sure to check server version before
using this property.

Regards,

"John Bell" <jbellnewsposts@.hotmail.com> wrote in message news:<3f1169cc$0$18750$afc38c87@.news.easynet.co.uk>...
> Hi
> Something like the following may be what you require:
> CREATE TABLE TestComputed ( Id INT IDENTITY NOT NULL, ID2 as 2*Id , Col1
> char(1) )
> SELECT OBJECT_NAME(id), Name, COLUMNPROPERTY( id ,name, 'ISComputed')
> FROM SYSCOLUMNS
> WHERE OBJECT_NAME(id) = 'TestComputed'
>
> John
>
> "Doug Baroter" <qwert12345@.boxfrog.com> wrote in message
> news:fc254714.0307122105.31f3c396@.posting.google.c om...
> > Hi,
> > I'm on SQL Server 2000, say, I have a table named [orders], how I find
> > if there is any column which has a formula in it? In other words, how
> > to identify formula column programmatically? I've looked at
> > information_schema.columns view for clue but to no avail.
> > Thanks.|||Thanks, Erland.

Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns93B8710A571B9Yazorman@.127.0.0.1>...
> Doug Baroter (qwert12345@.boxfrog.com) writes:
> > Thanks, John, yes, I got it with a slight twist, which might have been
> > intended by you. In the WHERE clause I ensures that COLUMNPROPERTY(
> > id ,name, 'ISComputed') is true. Also, since ComputedColumn is
> > introduced in SQL 2000, I make sure to check server version before
> > using this property.
> As far as I recall, computed columns were introduced in SQL7.

Friday, February 24, 2012

how to find C# in the text

I am not able to find C# using full text search of SQL 2005 beta 2
also, is there a way to enable some special words for indexing, such as c++,
c#,
thanks
--xin chne
I can find it. It seems to be case sensitive for C#(ie it can't find c#),
and it is case insensitive for c++.
Here is my repro
Create database XIN
GO
use XIN
GO
create table XIN
(pk int not null identity constraint primarykey1 primary key,
charcol char(20))
go
create fulltext catalog XIN as default
create fulltext index on XIN
(charcol) KEY INDEX primarykey1
insert into XIN (charcol) values('test')
insert into XIN (charcol) values('c')
insert into XIN (charcol) values('c++')
insert into XIN (charcol) values('c#')
insert into XIN (charcol) values('C')
insert into XIN (charcol) values('C++')
insert into XIN (charcol) values('C#')
select * from XIN where contains(*,'c') -- nothing
select * from XIN where contains(*,'c++') -- c++ and C++ returned
select * from XIN where contains(*,'c#') -- nothing
select * from XIN where contains(*,'C') -- nothing
select * from XIN where contains(*,'C++')-- c++ and C++ returned
select * from XIN where contains(*,'C#')--C# returned
--trying neutral
select * from XIN where contains(*,'c', language 0) -- nothing
select * from XIN where contains(*,'c++', language 0) -- c++ and C++
returned
select * from XIN where contains(*,'c#', language 0) -- nothing
select * from XIN where contains(*,'C', language 0) -- nothing
select * from XIN where contains(*,'C++', language 0)-- c++ and C++ returned
select * from XIN where contains(*,'C#', language 0) --C# returned
--removing c from the noise word list and rebuilding the index
select * from XIN where contains(*,'c') -- nothing
select * from XIN where contains(*,'c++') -- c++ and C++ returned
select * from XIN where contains(*,'c#') -- nothing
select * from XIN where contains(*,'C') -- nothing
select * from XIN where contains(*,'C++')-- c++ and C++ returned
select * from XIN where contains(*,'C#')--C# returned
Hilary Cotter
Looking for a SQL Server replication book?
http://www.nwsu.com/0974973602.html
Looking for a FAQ on Indexing Services/SQL FTS
http://www.indexserverfaq.com
"Xin Chen" <xchen@.xtremework.com> wrote in message
news:%23P3a9wWUFHA.628@.TK2MSFTNGP09.phx.gbl...
> I am not able to find C# using full text search of SQL 2005 beta 2
> also, is there a way to enable some special words for indexing, such as
c++,
> c#,
> thanks
> --xin chne
>