Solved

How to update this stored procedure?

Posted on 2009-04-02
2
181 Views
Last Modified: 2012-05-06
As a follow on from my previous question (accepted before asking this!), how could I do an inner join on the status?  

http://www.experts-exchange.com/Microsoft/Development/MS-SQL-Server/SQL-Server-2005/Q_24287818.html#a24047918

The dbo.Users.Status will be 7, but in the UsersTypes table 7 means "Administrator".  How can I do a join for my where clause so that if the status number (which is a row ID) ever changes it won't cause an issue.  EG having something like:

WHERE(dbo.Users.Status = dbo.UsersTypes.Code = "Administrator"

Or however you would do a join on that.
0
Comment
Question by:angus_young_acdc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 12

Accepted Solution

by:
udaya kumar laligondla earned 500 total points
ID: 24048082
I am assuming that you have dbo.UserTypes table which is having the userName as relation to the user table. if so use the code. if the field names are changed then use the same.
publish the table structures if more help needed

SELECT 
dbo.Users.UserName AS UserName, 
dbo.FileName.FileName
FROM dbo.Users 
INNER JOIN dbo.FileName ON dbo.Users.UserName = dbo.FileName.FilePrintStatus 
inner Join  dbo.UserTypes ON dbo.Users.UserName =  ON dbo.UsersTypes.UserName 
WHERE (dbo.UserTypes.Code = 'Administrator')

Open in new window

0
 
LVL 15

Author Closing Comment

by:angus_young_acdc
ID: 31565709
Thanks :)
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For both online and offline retail, the cross-channel business is the most recent pattern in the B2C trade space.
In this article we will learn how to fix  “Cannot install SQL Server 2014 Service Pack 2: Unable to install windows installer msi file” error ?
Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed
Via a live example, show how to setup several different housekeeping processes for a SQL Server.

615 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question