I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using MySQL to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
ChristophOn Thu, 19 Aug 2004 08:37:50 -0500, Christoph Boget wrote:
>I'm not sure if this is the right place to post this message. I
>didn't see a sqlserver.sql newsgroup.
>Anyway, we are porting our site from using MySQL to using
>SQLServer 2000 and we've run across a problem. In MySQL,
>you can have a query that looks like this (using Northwind DB
>as an example as that is ubiquitous):
>USE [Northwind];
>SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
>FROM
> Products;
>Such that it would print out the product name in one column
>and either the word 'Cheap' or 'Expensive' on the other column
>depending on the unitprice. This doesn't seem to work in
>SQLServer 2000 as it's giving me a syntax error at the IF. Is
>this possible using SQLServer? If so, how so?
>thnx,
>Christoph
>
Hi Christoph,
Check out CASE in Books Online. Your example would read:
SELECT ProductName,
CASE
WHEN UnitPrice < 20
THEN 'Cheap'
ELSE 'Expensive'
END AS ExpenseLevel
FROM Products
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Yep:
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap' ELSE 'Expensive' END AS ExpenseLevel
FROM
BTW, there is a .programming newsgroup.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using MySQL to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
Christoph|||Hi
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap'ELSE 'Expensive' END AS ExpenseLevel
FROM
Products;
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
> I'm not sure if this is the right place to post this message. I
> didn't see a sqlserver.sql newsgroup.
> Anyway, we are porting our site from using MySQL to using
> SQLServer 2000 and we've run across a problem. In MySQL,
> you can have a query that looks like this (using Northwind DB
> as an example as that is ubiquitous):
> USE [Northwind];
> SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
> FROM
> Products;
> Such that it would print out the product name in one column
> and either the word 'Cheap' or 'Expensive' on the other column
> depending on the unitprice. This doesn't seem to work in
> SQLServer 2000 as it's giving me a syntax error at the IF. Is
> this possible using SQLServer? If so, how so?
> thnx,
> Christoph
>
Showing posts with label porting. Show all posts
Showing posts with label porting. Show all posts
Wednesday, March 21, 2012
Monday, March 19, 2012
Help with a query
I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using MySQL to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
Christoph
On Thu, 19 Aug 2004 08:37:50 -0500, Christoph Boget wrote:
>I'm not sure if this is the right place to post this message. I
>didn't see a sqlserver.sql newsgroup.
>Anyway, we are porting our site from using MySQL to using
>SQLServer 2000 and we've run across a problem. In MySQL,
>you can have a query that looks like this (using Northwind DB
>as an example as that is ubiquitous):
>USE [Northwind];
>SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
>FROM
> Products;
>Such that it would print out the product name in one column
>and either the word 'Cheap' or 'Expensive' on the other column
>depending on the unitprice. This doesn't seem to work in
>SQLServer 2000 as it's giving me a syntax error at the IF. Is
>this possible using SQLServer? If so, how so?
>thnx,
>Christoph
>
Hi Christoph,
Check out CASE in Books Online. Your example would read:
SELECT ProductName,
CASE
WHEN UnitPrice < 20
THEN 'Cheap'
ELSE 'Expensive'
END AS ExpenseLevel
FROM Products
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Yep:
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap' ELSE 'Expensive' END AS ExpenseLevel
FROM
BTW, there is a .programming newsgroup.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using MySQL to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
Christoph
|||Hi
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap'ELSE 'Expensive' END AS ExpenseLevel
FROM
Products;
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
> I'm not sure if this is the right place to post this message. I
> didn't see a sqlserver.sql newsgroup.
> Anyway, we are porting our site from using MySQL to using
> SQLServer 2000 and we've run across a problem. In MySQL,
> you can have a query that looks like this (using Northwind DB
> as an example as that is ubiquitous):
> USE [Northwind];
> SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
> FROM
> Products;
> Such that it would print out the product name in one column
> and either the word 'Cheap' or 'Expensive' on the other column
> depending on the unitprice. This doesn't seem to work in
> SQLServer 2000 as it's giving me a syntax error at the IF. Is
> this possible using SQLServer? If so, how so?
> thnx,
> Christoph
>
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using MySQL to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
Christoph
On Thu, 19 Aug 2004 08:37:50 -0500, Christoph Boget wrote:
>I'm not sure if this is the right place to post this message. I
>didn't see a sqlserver.sql newsgroup.
>Anyway, we are porting our site from using MySQL to using
>SQLServer 2000 and we've run across a problem. In MySQL,
>you can have a query that looks like this (using Northwind DB
>as an example as that is ubiquitous):
>USE [Northwind];
>SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
>FROM
> Products;
>Such that it would print out the product name in one column
>and either the word 'Cheap' or 'Expensive' on the other column
>depending on the unitprice. This doesn't seem to work in
>SQLServer 2000 as it's giving me a syntax error at the IF. Is
>this possible using SQLServer? If so, how so?
>thnx,
>Christoph
>
Hi Christoph,
Check out CASE in Books Online. Your example would read:
SELECT ProductName,
CASE
WHEN UnitPrice < 20
THEN 'Cheap'
ELSE 'Expensive'
END AS ExpenseLevel
FROM Products
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||Yep:
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap' ELSE 'Expensive' END AS ExpenseLevel
FROM
BTW, there is a .programming newsgroup.
Tom
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using MySQL to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
Christoph
|||Hi
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap'ELSE 'Expensive' END AS ExpenseLevel
FROM
Products;
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
> I'm not sure if this is the right place to post this message. I
> didn't see a sqlserver.sql newsgroup.
> Anyway, we are porting our site from using MySQL to using
> SQLServer 2000 and we've run across a problem. In MySQL,
> you can have a query that looks like this (using Northwind DB
> as an example as that is ubiquitous):
> USE [Northwind];
> SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
> FROM
> Products;
> Such that it would print out the product name in one column
> and either the word 'Cheap' or 'Expensive' on the other column
> depending on the unitprice. This doesn't seem to work in
> SQLServer 2000 as it's giving me a syntax error at the IF. Is
> this possible using SQLServer? If so, how so?
> thnx,
> Christoph
>
Help with a query
I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using mysql to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
ChristophOn Thu, 19 Aug 2004 08:37:50 -0500, Christoph Boget wrote:
>I'm not sure if this is the right place to post this message. I
>didn't see a sqlserver.sql newsgroup.
>Anyway, we are porting our site from using mysql to using
>SQLServer 2000 and we've run across a problem. In MySQL,
>you can have a query that looks like this (using Northwind DB
>as an example as that is ubiquitous):
>USE [Northwind];
>SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
>FROM
> Products;
>Such that it would print out the product name in one column
>and either the word 'Cheap' or 'Expensive' on the other column
>depending on the unitprice. This doesn't seem to work in
>SQLServer 2000 as it's giving me a syntax error at the IF. Is
>this possible using SQLServer? If so, how so?
>thnx,
>Christoph
>
Hi Christoph,
Check out CASE in Books Online. Your example would read:
SELECT ProductName,
CASE
WHEN UnitPrice < 20
THEN 'Cheap'
ELSE 'Expensive'
END AS ExpenseLevel
FROM Products
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Yep:
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap' ELSE 'Expensive' END AS ExpenseLevel
FROM
BTW, there is a .programming newsgroup.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using mysql to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
Christoph|||Hi
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap'ELSE 'Expensive' END AS ExpenseLevel
FROM
Products;
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
> I'm not sure if this is the right place to post this message. I
> didn't see a sqlserver.sql newsgroup.
> Anyway, we are porting our site from using mysql to using
> SQLServer 2000 and we've run across a problem. In MySQL,
> you can have a query that looks like this (using Northwind DB
> as an example as that is ubiquitous):
> USE [Northwind];
> SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
> FROM
> Products;
> Such that it would print out the product name in one column
> and either the word 'Cheap' or 'Expensive' on the other column
> depending on the unitprice. This doesn't seem to work in
> SQLServer 2000 as it's giving me a syntax error at the IF. Is
> this possible using SQLServer? If so, how so?
> thnx,
> Christoph
>
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using mysql to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
ChristophOn Thu, 19 Aug 2004 08:37:50 -0500, Christoph Boget wrote:
>I'm not sure if this is the right place to post this message. I
>didn't see a sqlserver.sql newsgroup.
>Anyway, we are porting our site from using mysql to using
>SQLServer 2000 and we've run across a problem. In MySQL,
>you can have a query that looks like this (using Northwind DB
>as an example as that is ubiquitous):
>USE [Northwind];
>SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
>FROM
> Products;
>Such that it would print out the product name in one column
>and either the word 'Cheap' or 'Expensive' on the other column
>depending on the unitprice. This doesn't seem to work in
>SQLServer 2000 as it's giving me a syntax error at the IF. Is
>this possible using SQLServer? If so, how so?
>thnx,
>Christoph
>
Hi Christoph,
Check out CASE in Books Online. Your example would read:
SELECT ProductName,
CASE
WHEN UnitPrice < 20
THEN 'Cheap'
ELSE 'Expensive'
END AS ExpenseLevel
FROM Products
Best, Hugo
--
(Remove _NO_ and _SPAM_ to get my e-mail address)|||Yep:
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap' ELSE 'Expensive' END AS ExpenseLevel
FROM
BTW, there is a .programming newsgroup.
Tom
---
Thomas A. Moreau, BSc, PhD, MCSE, MCDBA
SQL Server MVP
Columnist, SQL Server Professional
Toronto, ON Canada
www.pinnaclepublishing.com/sql
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
I'm not sure if this is the right place to post this message. I
didn't see a sqlserver.sql newsgroup.
Anyway, we are porting our site from using mysql to using
SQLServer 2000 and we've run across a problem. In MySQL,
you can have a query that looks like this (using Northwind DB
as an example as that is ubiquitous):
USE [Northwind];
SELECT
ProductName,
IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
FROM
Products;
Such that it would print out the product name in one column
and either the word 'Cheap' or 'Expensive' on the other column
depending on the unitprice. This doesn't seem to work in
SQLServer 2000 as it's giving me a syntax error at the IF. Is
this possible using SQLServer? If so, how so?
thnx,
Christoph|||Hi
USE [Northwind];
SELECT
ProductName,
CASE WHEN UnitPrice < 20 THEN 'Cheap'ELSE 'Expensive' END AS ExpenseLevel
FROM
Products;
"Christoph Boget" <jcboget@.yahoo.com> wrote in message
news:uylq2GfhEHA.4064@.TK2MSFTNGP12.phx.gbl...
> I'm not sure if this is the right place to post this message. I
> didn't see a sqlserver.sql newsgroup.
> Anyway, we are porting our site from using mysql to using
> SQLServer 2000 and we've run across a problem. In MySQL,
> you can have a query that looks like this (using Northwind DB
> as an example as that is ubiquitous):
> USE [Northwind];
> SELECT
> ProductName,
> IF( UnitPrice < 20, 'Cheap', 'Expensive' ) AS ExpenseLevel
> FROM
> Products;
> Such that it would print out the product name in one column
> and either the word 'Cheap' or 'Expensive' on the other column
> depending on the unitprice. This doesn't seem to work in
> SQLServer 2000 as it's giving me a syntax error at the IF. Is
> this possible using SQLServer? If so, how so?
> thnx,
> Christoph
>
Subscribe to:
Posts (Atom)