Showing posts with label testcompare. Show all posts
Showing posts with label testcompare. Show all posts

Wednesday, March 7, 2012

Operation on View

Hi All,
It is possilble in some way to make operation in a view?
Example:
SELECT fieldA > fieldB AS TestCompare FROM myTable
ThanksFor example:
SELECT
CASE WHEN a > b THEN 'A' ELSE 'B' END AS test_compare
FROM myTable ;
David Portas
SQL Server MVP
--|||What would you want the comparsion fieldA > fieldB to return? There's no Boo
lean datatype in SQL
Server. How about returning a string, something like:
SELECT
CASE WHEN fieldA > fieldB THEN 'ColA_GT'
ELSE 'ColANotGT'
END AS TestCompare
FROM myTable
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Bonato Pierantonio" <pbonato@.interfree.it> wrote in message
news:Ob1Opt0wFHA.3788@.TK2MSFTNGP10.phx.gbl...
> Hi All,
> It is possilble in some way to make operation in a view?
> Example:
> SELECT fieldA > fieldB AS TestCompare FROM myTable
> Thanks
>