Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Switch Expresssion isnt cooperating

Author  Topic 

WLP5318
Starting Member

2 Posts

Posted - 2010-08-24 : 13:08:28
=Switch (fields!Created_By.Value=190,'Dorothy')
Switch(fields!Created_By.Value=224,'Lewis')
Switch(fields!Created_By.Value=212,'Terri')
Switch(fields!Created_By.Value=292,'WendyP'))))

The last line here is underlined in red. I dont know of any other way to end the expresssion

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-08-24 : 13:24:49
Switch is C#, not T-SQL

Working in Access or Excel maybe?

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

WLP5318
Starting Member

2 Posts

Posted - 2010-08-24 : 13:29:44
I am so unfamiliar with SQL but determined to learn it. I am using VB 2005.
Go to Top of Page

DonAtWork
Master Smack Fu Yak Hacker

2167 Posts

Posted - 2010-08-24 : 13:41:56
If you are determined to learn, follow the links in my signature under Basic Questions. They are great for those just starting out in SQL.

http://weblogs.sqlteam.com/jeffs/archive/2008/05/13/question-needed-not-answer.aspx
How to ask: http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx

For ultra basic questions, follow these links.
http://www.sql-tutorial.net/
http://www.firstsql.com/tutor.htm
http://www.w3schools.com/sql/default.asp
Go to Top of Page

Chamark
Starting Member

28 Posts

Posted - 2010-08-24 : 14:50:12
This looks like something from Reporting Services (SSRS) - if not my bad - but should be able to do this
=Switch(fields!Created_By.Value=190,"Dorothy", fields!Created_By.Value=224,"Lewis",fields!Created_By.Value=212,"Terri",
fields!Created_By.Value=292,"WendyP")
Go to Top of Page
   

- Advertisement -