Click here to Skip to main content
15,914,109 members
Home / Discussions / Database
   

Database

 
AnswerRe: How to move data from local database to web server database? Pin
Wendelius2-Nov-08 0:01
mentorWendelius2-Nov-08 0:01 
QuestionWhere can I download SQL Server 2000 Books Online (SQL BOL)? Pin
Rameez Raja1-Nov-08 19:36
Rameez Raja1-Nov-08 19:36 
AnswerRe: Where can I download SQL Server 2000 Books Online (SQL BOL)? Pin
Wendelius1-Nov-08 21:44
mentorWendelius1-Nov-08 21:44 
QuestionIs there a better solution to check today's record? Pin
lingerpop1-Nov-08 19:18
lingerpop1-Nov-08 19:18 
AnswerRe: Is there a better solution to check today's record? Pin
Wendelius1-Nov-08 21:52
mentorWendelius1-Nov-08 21:52 
QuestionConversion from varchar data type into datetime in sql server 2000 Pin
Rameez Raja1-Nov-08 19:10
Rameez Raja1-Nov-08 19:10 
AnswerRe: Conversion from varchar data type into datetime in sql server 2000 Pin
Wendelius1-Nov-08 21:32
mentorWendelius1-Nov-08 21:32 
QuestionUsing Stored Procedure or View in the following scenario Pin
ashwanigl1-Nov-08 17:47
ashwanigl1-Nov-08 17:47 
This question is related to the performance of using Stored Procedure OR Views in the following scenario.

We are building an application for Multiple Organizations (Tenants) and using the Shared Database approach for maintaining the data. So Every Table in our database will have TenantId column. Sample Table is shown here:

CREATE TABLE [ent].[tbl_NetworkProfileTemplate](
[PK_NetworkProfileTemplateId] [int] IDENTITY(1,1) NOT FOR REPLICATION NOT NULL,
[ProfileTemplateName] [nvarchar](20) NOT NULL,
[ProfileTemplateDescription] [nvarchar](255) NULL,
[FK_TenantId] [int] NOT NULL,
CONSTRAINT [PK_tbl_NetworkProfileTemplate] PRIMARY KEY CLUSTERED
(
[PK_NetworkProfileTemplateId] ASC,
[FK_TenantId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, FILLFACTOR = 90) ON [TenantPScheme]([FK_TenantId])
)

Now I want to Protect (filter) the data at the database level: If User belonging to Tenant Id =1 logins into the application that user will see records only for that Tenant. And I want this filtration of data at the Database level so developers writing the code in the business layer doesnot need to worry about the filtration of data.

So there are possibly two solutions for this
1. Create stored procedures for each table to fetch, insert, delete and update the records. The logic in the stored procedure will filter the records based upon the Connection with the Database. (Each Tenant will have separate database User)
2. Create views of each table that will filter out the records based upon the Connection with the database.
Create VIEW [ent].[vw_NetworkProfileTemplate]
AS
SELECT
*
FROM [ent].[tbl_NetworkProfileTemplate]
WHERE FK_TenantId= system_user

I see lot of advantages of using views in my applications
Many applications these days are created where we write inline queries and stored procedures also, so using views does not effect our development of Middle layer too much. Also these days we are using OR Mapper tools so this will be helpful in case of views but not in stored procedures approach.

Some of my company DBA’s told me that there is considerable performance hit and scalability issues when using Views, so use Stored procedures. I did some research on that and see the execution plan for the various queries like fetching the data from these tables using joins with other tables etc. but execution plan is exactly same.
My question is that the view which I have created above is slower or have scalability issues compared to using the stored procedures?

Please answer by looking by my View. This view is very simple and have only one where clause in it.
AnswerRe: Using Stored Procedure or View in the following scenario Pin
Wendelius1-Nov-08 22:21
mentorWendelius1-Nov-08 22:21 
GeneralRe: Using Stored Procedure or View in the following scenario Pin
ashwanigl2-Nov-08 1:29
ashwanigl2-Nov-08 1:29 
GeneralRe: Using Stored Procedure or View in the following scenario Pin
Wendelius2-Nov-08 1:31
mentorWendelius2-Nov-08 1:31 
Questionsample insert statment Pin
Zlemox1-Nov-08 15:32
Zlemox1-Nov-08 15:32 
AnswerRe: sample insert statment Pin
Ashfield2-Nov-08 20:03
Ashfield2-Nov-08 20:03 
QuestionIs it possible to convert a data base in a exe file? Pin
r_mohd1-Nov-08 11:50
r_mohd1-Nov-08 11:50 
AnswerRe: Is it possible to convert a data base in a exe file? Pin
Rob Graham1-Nov-08 15:31
Rob Graham1-Nov-08 15:31 
AnswerRe: Is it possible to convert a data base in a exe file? Pin
Wendelius1-Nov-08 22:28
mentorWendelius1-Nov-08 22:28 
QuestionHow to get the last record .. Stored Procedure? Pin
kindman_nb1-Nov-08 5:54
kindman_nb1-Nov-08 5:54 
AnswerRe: How to get the last record .. Stored Procedure? Pin
Blue_Boy1-Nov-08 7:01
Blue_Boy1-Nov-08 7:01 
GeneralRe: How to get the last record .. Stored Procedure? Pin
Rob Graham1-Nov-08 7:07
Rob Graham1-Nov-08 7:07 
AnswerRe: How to get the last record .. Stored Procedure? Pin
Rob Graham1-Nov-08 7:05
Rob Graham1-Nov-08 7:05 
GeneralRe: How to get the last record .. Stored Procedure? Pin
r_mohd1-Nov-08 11:46
r_mohd1-Nov-08 11:46 
QuestionPervasive 9 Pin
Zeyad Jalil1-Nov-08 4:01
professionalZeyad Jalil1-Nov-08 4:01 
AnswerRe: Pervasive 9 Pin
Ashfield2-Nov-08 21:14
Ashfield2-Nov-08 21:14 
Questionstored procedure for executing another proc generates error Pin
sunny741-Nov-08 0:47
sunny741-Nov-08 0:47 
AnswerRe: stored procedure for executing another proc generates error Pin
Ashfield2-Nov-08 20:10
Ashfield2-Nov-08 20:10 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.