Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Friday, March 23, 2012

Nesting views?

OK say a user creates a view "A"...
Now another user comes along and creates a view "B" which joins view "A"
plus other tables.
Now yet another user creates a view "C" which uses "B"...
Supported yes but is this really wise? It really begins to be convoluded
quickly. Seems to me a view is to abstract data to the user not to use as a
crutch when writing procs. Is this just me being dumb or narrow minded? Or
is this not considered a good practice?Views can provide a well-defined client application interface as well as
horizontal and vertical partitioning functionality. Views can also be used
for query encapsulation, but you don't want to go overboard with nesting.
I once worked with a application (upsized from Access) that had views nested
up to 8 levels deep. Debugging functionality and performance was a real
challenge.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"Tim Greenwood" <tim_greenwood A-T yahoo D-O-T com> wrote in message
news:O4XU8%235aGHA.4612@.TK2MSFTNGP03.phx.gbl...
> OK say a user creates a view "A"...
> Now another user comes along and creates a view "B" which joins view "A"
> plus other tables.
> Now yet another user creates a view "C" which uses "B"...
> Supported yes but is this really wise? It really begins to be convoluded
> quickly. Seems to me a view is to abstract data to the user not to use as
> a crutch when writing procs. Is this just me being dumb or narrow minded?
> Or is this not considered a good practice?
>|||"Tim Greenwood" <tim_greenwood A-T yahoo D-O-T com> wrote in message
news:O4XU8%235aGHA.4612@.TK2MSFTNGP03.phx.gbl...
> OK say a user creates a view "A"...
> Now another user comes along and creates a view "B" which joins view "A"
> plus other tables.
> Now yet another user creates a view "C" which uses "B"...
> Supported yes but is this really wise? It really begins to be convoluded
> quickly. Seems to me a view is to abstract data to the user not to use as
> a crutch when writing procs. Is this just me being dumb or narrow minded?
> Or is this not considered a good practice?
>
I try to structure a SQL Server application like this
---
| Business Processes |
|---
| Business Logic | The Application Tier
|---
| Database Transactions |
| *******************************
| * Stored Procedures |
************-- |
| Views and Table-Valued UDF's | | The Data Tier
---
| Tables |
---
So the tables are accessed via views, UDF's and Stored Procedures. Together
the views, UDF's and Stored Procedures provide the interface to the data
tier. The application tier defines transactions by composing elemetnts
exposed by the data tier.
The Database Transactions and even the Business Logic might be implemented
in TSQL, although they are more likely in .NET. The choice of language
there depends more on factors like the complexity of the applicaiton,
performance requirements, team skillset, the need for production debugging
and tuning, etc.
There's no real reason, however, to wrap tables in views and stored
procedures that don't do anything. Using views that pass through single
tables, and stored procedures that insert single rows acomplishes little.
If you're tempted there, just remember that there are worse things in life
than having a sub-optimal application architecture. Like failing to deliver
on time, or not delighting your users, or performing poorly, or spending all
your time learning technology rather than delivering business value.
David

Nesting views?

OK say a user creates a view "A"...
Now another user comes along and creates a view "B" which joins view "A"
plus other tables.
Now yet another user creates a view "C" which uses "B"...
Supported yes but is this really wise? It really begins to be convoluded
quickly. Seems to me a view is to abstract data to the user not to use as a
crutch when writing procs. Is this just me being dumb or narrow minded? Or
is this not considered a good practice?Views can provide a well-defined client application interface as well as
horizontal and vertical partitioning functionality. Views can also be used
for query encapsulation, but you don't want to go overboard with nesting.
I once worked with a application (upsized from Access) that had views nested
up to 8 levels deep. Debugging functionality and performance was a real
challenge.
Hope this helps.
Dan Guzman
SQL Server MVP
"Tim Greenwood" <tim_greenwood A-T yahoo D-O-T com> wrote in message
news:O4XU8%235aGHA.4612@.TK2MSFTNGP03.phx.gbl...
> OK say a user creates a view "A"...
> Now another user comes along and creates a view "B" which joins view "A"
> plus other tables.
> Now yet another user creates a view "C" which uses "B"...
> Supported yes but is this really wise? It really begins to be convoluded
> quickly. Seems to me a view is to abstract data to the user not to use as
> a crutch when writing procs. Is this just me being dumb or narrow minded?
> Or is this not considered a good practice?
>|||"Tim Greenwood" <tim_greenwood A-T yahoo D-O-T com> wrote in message
news:O4XU8%235aGHA.4612@.TK2MSFTNGP03.phx.gbl...
> OK say a user creates a view "A"...
> Now another user comes along and creates a view "B" which joins view "A"
> plus other tables.
> Now yet another user creates a view "C" which uses "B"...
> Supported yes but is this really wise? It really begins to be convoluded
> quickly. Seems to me a view is to abstract data to the user not to use as
> a crutch when writing procs. Is this just me being dumb or narrow minded?
> Or is this not considered a good practice?
>
I try to structure a SQL Server application like this
---
| Business Processes |
|---
| Business Logic | The Application Tier
|---
| Database Transactions |
| *******************************
| * Stored Procedures |
************-- |
| Views and Table-Valued UDF's | | The Data Tier
---
| Tables |
---
So the tables are accessed via views, UDF's and Stored Procedures. Together
the views, UDF's and Stored Procedures provide the interface to the data
tier. The application tier defines transactions by composing elemetnts
exposed by the data tier.
The Database Transactions and even the Business Logic might be implemented
in TSQL, although they are more likely in .NET. The choice of language
there depends more on factors like the complexity of the applicaiton,
performance requirements, team skillset, the need for production debugging
and tuning, etc.
There's no real reason, however, to wrap tables in views and stored
procedures that don't do anything. Using views that pass through single
tables, and stored procedures that insert single rows acomplishes little.
If you're tempted there, just remember that there are worse things in life
than having a sub-optimal application architecture. Like failing to deliver
on time, or not delighting your users, or performing poorly, or spending all
your time learning technology rather than delivering business value.
David

Nesting a SP within another SP?

I have a stored procedure that calls some UDF User Defined Functions,
the purpose of which is to create row strings out of numerous column
strings for matching uniqueIDs.

The problem is I need to join that SP with some other tables.

The SP I have reads something like:

mySPName
@.myUserID int
SELECT myUniqueID, dbo.fn_myFunctionName(UniqueID) As myRunningString
FROM myTEMPTableName
GROUP BY myUniqueID
WHERE myTEMPTableName.UserID = @.myUserID

I need to join that result with myTableName on myUniqueID such as:
Select myTableName.myField1, myTableName.myField2,
mySPName.myRunningString
From ...
-- joining myTableName.myUniqueID = mySPName.myUniqueID

Can this be done?
The reason I don't just do it with a View instead of an SP is that I
have that parameter that must be passed to filter the records in
myTEMPTableName.

Any help is appreciated.
lq

oh...
the UDF looks like:

Create Function dbo.fn_myFunctionName(@.myUniqueID as int) returns
nvarchar(500)
AS
BEGIN
DECLARE @.ret_value nvarchar(500)
SET @.ret_value=''
SELECT @.ret_value=@.ret_value + ';' + myString
FROM myTEMPTableName
WHERE
myUniqueID =@.myUniqueID
RETURN RIGHT(@.ret_value,Len(@.ret_value)-2)
ENDlaurenquantrell@.hotmail.com (Lauren Quantrell) wrote in message news:<47e5bd72.0401272245.449a0756@.posting.google.com>...
> I have a stored procedure that calls some UDF User Defined Functions,
> the purpose of which is to create row strings out of numerous column
> strings for matching uniqueIDs.
> The problem is I need to join that SP with some other tables.
> The SP I have reads something like:
> mySPName
> @.myUserID int
> SELECT myUniqueID, dbo.fn_myFunctionName(UniqueID) As myRunningString
> FROM myTEMPTableName
> GROUP BY myUniqueID
> WHERE myTEMPTableName.UserID = @.myUserID
> I need to join that result with myTableName on myUniqueID such as:
> Select myTableName.myField1, myTableName.myField2,
> mySPName.myRunningString
> From ...
> -- joining myTableName.myUniqueID = mySPName.myUniqueID
> Can this be done?
> The reason I don't just do it with a View instead of an SP is that I
> have that parameter that must be passed to filter the records in
> myTEMPTableName.
> Any help is appreciated.
> lq
> oh...
> the UDF looks like:
> Create Function dbo.fn_myFunctionName(@.myUniqueID as int) returns
> nvarchar(500)
> AS
> BEGIN
> DECLARE @.ret_value nvarchar(500)
> SET @.ret_value=''
> SELECT @.ret_value=@.ret_value + ';' + myString
> FROM myTEMPTableName
> WHERE
> myUniqueID =@.myUniqueID
> RETURN RIGHT(@.ret_value,Len(@.ret_value)-2)
> END

There are some options described here:

http://www.sommarskog.se/share_data.html

From your description, rewriting the stored procedure as a
table-valued UDF sounds like it should be possible.

Simon

Wednesday, March 21, 2012

Nested Stored Procedure?

I have a stored procedure that returns a list of userIds that are available to the logged in user. I need to be able to use this list of userIds in another stored procedure whose purpose is to simply query a table for all results containing any of those userIds.

So if my first Stored Procedure returns this:
2
3
5
6

I need my select statement to do something like this:

select UserId, Column1, Column2
from Table1
where UserId = 2 or UserId = 3 or UserId = 5 or UserId = 6

I'm very new to stored procedures, can anyone help me with the syntax for doing this. I'm being pressured to get this done very quickly.

Thanks for any help!Huh? User ids like SQL Server User ids, or something application specific?

-PatP|||Eric1776,

There are 2 options to choose from:

Option 1 is to use a subselect, your select statement will look like this.

select UserId, Column1, Column2
from Table1
where UserID IN (Select UserID FROM UserID_Table)

Option 2 is to create a function instead of a stored procedure to return the valid User ID's, your script would look like this.

CREATE FUNCTION dbo.func_Return_UserID ()
RETURNS TABLE AS
RETURN SELECT UserID FROM UserID_Table
GO

select UserId, Column1, Column2
from Table1
where UserID IN (Select UserID FROM dbo.func_Return_UserID ())

Regards,
K3n|||Eric1776,

There are 2 options to choose from:

Option 1 is to use a subselect, your select statement will look like this.

select UserId, Column1, Column2
from Table1
where UserID IN (Select UserID FROM UserID_Table)

Option 2 is to create a function instead of a stored procedure to return the valid User ID's, your script would look like this.

CREATE FUNCTION dbo.func_Return_UserID ()
RETURNS TABLE AS
RETURN SELECT UserID FROM UserID_Table
GO

select UserId, Column1, Column2
from Table1
where UserID IN (Select UserID FROM dbo.func_Return_UserID ())

Regards,
K3n
Is it possible to use Option 1 with a stored procedure instead of a select statement?|||CREATE TABLE #tmp_user_list ( UserID INT)

INSERT INTO #tmp_user_list(UserID)
EXEC proc_name

SELECT * FROM #tmp_user_list -- Test only

select UserId, Column1, Column2
from Table1
where UserID IN (Select UserID FROM #tmp_user_list)

DROP TABLE #tmp_user_list

The above is how I solved this type of problem in SQL 7.0

Tim S|||CREATE TABLE #tmp_user_list ( UserID INT)

INSERT INTO #tmp_user_list(UserID)
EXEC proc_name

SELECT * FROM #tmp_user_list -- Test only

select UserId, Column1, Column2
from Table1
where UserID IN (Select UserID FROM #tmp_user_list)

DROP TABLE #tmp_user_list

The above is how I solved this type of problem in SQL 7.0

Tim S

Thanks! I should have thought of that. :) Its working great now.

Monday, March 19, 2012

Nested Recordsets

I need to decrease the amount of time it takes to return a set of data of the following format:

State[Provided vai user intput]->All Counties in State->All Cities in County->All Zones in City[usually < 50 or 75 per city]

current behavior:
1. currently user selects state all counties are returned from db
2. foreach county cities are returned
3. foreach city streets are returned
4. objects hydrated with data & display drawn

As you can see this gets expensive. I know there has to be a better way to do this. Any suggestions? We use sql server/c#.net.Unclear what you want here. If you just want to return all the counties, cities, streets, etc for a given State, just use a multi-table query with indexed foreign keys.|||Are you using Cursors or subqueries to retrive all those informations ?|||hydrated??|||Look it up in Books Online, Rudy.|||thank you, but i couldn't find it

would you be kind enough to give me the exact url|||Ha! Made you look!

Sorry, Rudy, but for some reason at 12:30 last night the idea of you searching Books Online for "hydrated" seemed hillariously funny to me.

D'oh!|||yeah, well, i even tried google, searching for "microsoft sql server hydrate"

found this -- http://www.devarticles.com/showblog/345/Could-you-pee-on-my-sandwich-please|||The order of data retrieval looks a little backwards, - should you let the user select a country first? And don't you have a relation between countries and states?

Wednesday, March 7, 2012

Needed: User, Login, Connection advice.

HI,
I'm still on the steep side of the learning curve with ASP.NET. I've looked through a number of threads on this forum, and have gotten pieces of the answer, but need help getting past a roadblock.

I haven't been able to get a simple test application to connect to the Pubs database loaded on my system running MSDE. The only control in the application is a WebDataForm created by the Wizard. Everything works well (even the Preview Data form the Data menu loads and displays the correct data), except when the form is viewed in a browser. Click the load button and an error:Login failed for user 'NT AUTHORITY\NETWORK SERVICE'.

Similar stories are common on this forum, and I tried to address the problem. I'm quite sure it's a autherization or authentication problem. I have Windows Server 2003 (with IIS 6.0), VS.NET 03 and MSDE as the SQL server on the same box. The MSDE server is using Windows Security mode. I Created a new user called ASPNET on the Windows Server. I added a login to the SQL Server 'WinServerName\ASPNET' using windows auth. Still get the same login failed message.

Is there something I'm missing? Do I have to add a new user to IIS?

For the record, what users/settings do I need to have in Windows, SQL-Server and IIS, get past this login problem.

Thanks for answering this basic question - one more time.Hi,
An Addendum to my message:

I found out that WINDOWS SERVER 2003 in native mode (default), running IIS 6.0 Uses "NETWORK SERVICE" rather than "ASPNET" as the default login user name for ASP.NET applications. I had not seen this in the messages I looked through in this forum.

When I, after a number of dead ends, created a new Login for my SQL Server - (as I'm using MSDE, I used The Web Data Administrator rather than Enterprise Manager or OSQL to create the new login) - with the name 'NT AUTHORITY\NETWORK SERVICE', the application was able to access the database through the VS and IE browswers.

As this test application is only used locally, I'm not concerned with the security ramifications of this method of access. However, I can see that it will be a big concern, and a lot of work to establish the appropriate methods when I have a production application to deploy.

I still would welcome advice on what strategies you have used to provide appropriate access privilages to ASP.NET applications and users that will need to access data from SQL Server databases in production environments.

I know that this is asking a lot - as there are so many permutations to consider. What I would hope you could provide, is a base line of "must" and "must never" stepsfor establishing data connections to data sources using ASP.NET.

If this is too open ended a question - let me know your thoughts on that as well. In looking through the messages of the past 3 months on this forum, I know that many have been frustrated by the complxity of getting a database connection established. Yes, the information to get it done is out there, but the sheer volume can be daunting.

Thanks for all you help with my questions.

Saturday, February 25, 2012

Need to write value of session variable to SQL record

Each user who inserts a new SQL record from the FormView control needs to have their UserID in one of the fields of the record. I have the user ID stored in the Session("UserID") variable. I am having trouble finding the right way to get this done. I have tried using a hidden text box but I can't seem to assign the value. I have tried the Insert Parameters but that will not accept <%# Session("UserID") %> as a DefaultValue. Any ideas would be helpful. Thanks.

Try handling the ItemInserting event of your FormView where you can programmatically set the SqlDataSource.DefaultValue to your Session variable value. For example:

protected void FormView1_ItemInserting(object sender, FormViewInsertEventArgs e)
{
SqlDataSource1.InsertParameters["UserID"].DefaultValue = Session["UserID"].ToString();
}|||Worked great with "(" instead of brackets "[". Thanks!|||I'm glad it worked out. My example was in C#. I guess you needed VB sample instead.|||You could of also created a SessionParameter and done it without any code at all.|||

Motley wrote:

You could of also created a SessionParameter and done it without any code at all.

Brilliant!!!

Monday, February 20, 2012

Need to update up to 3000 user DB

Hi,
We have an SQL 2005 Server with the whole enterprise data.
We are building an application that requires a per user database with its
own data (horizontal filtering).
Our first idea is to create 3000 mdf files, one db for each user. This DB is
created by copying a "model" db with the data structure, then using
SqlExpress's AttachDbFilename feature to connect to user db and fill it with
filtered data from the main server. Each user DB has the main server in its
linked servers in order to be able to query the main server from the user DB
and compare data from both sides (to find the differences). Subsequent
updates are done using the same SQL queries. MDF files are stored on a
server that has SQL Express installed to which the app connects.
This solution works well but the problem is that each user DB update (near
300 Sql requests for 50 mb results DB) requires at least 30 seconds to
execute. 3000 users means 25 hours to complete the whole process. The main
server stay at low CPU level, but the "express" server quickly increase its
CPU usage (near 100% when 4 updating threads are working simultaneously),
but we cannot buy a 64 cpu computer ;).
We are looking for a faster solution. Do you have any idea which could help
us either to optimize our solution or even another method ?
We do not want to use the Sql Server replication because it is not
applicable in our environment.
Buying other SQL Server is possible but must be justified.
Thanks,
SteveSteve
> Our first idea is to create 3000 mdf files, one db for each user. This DB
> is created by copying a "model" db with the data structure, then using
Actually you have not explained what are you trying to achive?
What is if the data will be stored in one database? Where do user locate?
How do they access the database?
We have many customers installed on their workstations MSDE/EXPRESS and just
pushed the data (as a publisher) from pur main server . Yep , it is a
replication which sometimes has some problems that hard to solve.
"Steve B." <steve_beauge@.com.msn_swap_com_and_msn> wrote in message
news:%23%23SBw8nTGHA.6048@.TK2MSFTNGP11.phx.gbl...
> Hi,
> We have an SQL 2005 Server with the whole enterprise data.
> We are building an application that requires a per user database with its
> own data (horizontal filtering).
> Our first idea is to create 3000 mdf files, one db for each user. This DB
> is created by copying a "model" db with the data structure, then using
> SqlExpress's AttachDbFilename feature to connect to user db and fill it
> with filtered data from the main server. Each user DB has the main server
> in its linked servers in order to be able to query the main server from
> the user DB and compare data from both sides (to find the differences).
> Subsequent updates are done using the same SQL queries. MDF files are
> stored on a server that has SQL Express installed to which the app
> connects.
> This solution works well but the problem is that each user DB update (near
> 300 Sql requests for 50 mb results DB) requires at least 30 seconds to
> execute. 3000 users means 25 hours to complete the whole process. The main
> server stay at low CPU level, but the "express" server quickly increase
> its CPU usage (near 100% when 4 updating threads are working
> simultaneously), but we cannot buy a 64 cpu computer ;).
> We are looking for a faster solution. Do you have any idea which could
> help us either to optimize our solution or even another method ?
> We do not want to use the Sql Server replication because it is not
> applicable in our environment.
> Buying other SQL Server is possible but must be justified.
> Thanks,
> Steve
>|||The Sql express db are used to store an image of data that each user
require.
The actual "end user" application is a mobile application in which a sql
mobile DB is synchronized against a http application that will make all the
required work to ensure the sql mobile DB has exactly the same data than the
Sql express one.
This "intermediary" sql express db is required since the MS Merge
replication between sql 2005 and mobile device can't be used because of
replication limitations.
Since the main DB is quite big, we want to compute differences for each user
within the lan, before sending it to the device (that's why we want to use
mdf files that are exact copy of the data for the user, which is easier to
synchronize since it is 1-1 with the device).
Thanks,
Steve
"Uri Dimant" <urid@.iscar.co.il> a écrit dans le message de news:
%23LSWwGoTGHA.4956@.TK2MSFTNGP09.phx.gbl...
> Steve
>> Our first idea is to create 3000 mdf files, one db for each user. This DB
>> is created by copying a "model" db with the data structure, then using
> Actually you have not explained what are you trying to achive?
> What is if the data will be stored in one database? Where do user locate?
> How do they access the database?
> We have many customers installed on their workstations MSDE/EXPRESS and
> just pushed the data (as a publisher) from pur main server . Yep , it is a
> replication which sometimes has some problems that hard to solve.
>
>
>
> "Steve B." <steve_beauge@.com.msn_swap_com_and_msn> wrote in message
> news:%23%23SBw8nTGHA.6048@.TK2MSFTNGP11.phx.gbl...
>> Hi,
>> We have an SQL 2005 Server with the whole enterprise data.
>> We are building an application that requires a per user database with its
>> own data (horizontal filtering).
>> Our first idea is to create 3000 mdf files, one db for each user. This DB
>> is created by copying a "model" db with the data structure, then using
>> SqlExpress's AttachDbFilename feature to connect to user db and fill it
>> with filtered data from the main server. Each user DB has the main server
>> in its linked servers in order to be able to query the main server from
>> the user DB and compare data from both sides (to find the differences).
>> Subsequent updates are done using the same SQL queries. MDF files are
>> stored on a server that has SQL Express installed to which the app
>> connects.
>> This solution works well but the problem is that each user DB update
>> (near 300 Sql requests for 50 mb results DB) requires at least 30 seconds
>> to execute. 3000 users means 25 hours to complete the whole process. The
>> main server stay at low CPU level, but the "express" server quickly
>> increase its CPU usage (near 100% when 4 updating threads are working
>> simultaneously), but we cannot buy a 64 cpu computer ;).
>> We are looking for a faster solution. Do you have any idea which could
>> help us either to optimize our solution or even another method ?
>> We do not want to use the Sql Server replication because it is not
>> applicable in our environment.
>> Buying other SQL Server is possible but must be justified.
>> Thanks,
>> Steve
>

Need to update up to 3000 user DB

Hi,
We have an SQL 2005 Server with the whole enterprise data.
We are building an application that requires a per user database with its
own data (horizontal filtering).
Our first idea is to create 3000 mdf files, one db for each user. This DB is
created by copying a "model" db with the data structure, then using
SqlExpress's AttachDbFilename feature to connect to user db and fill it with
filtered data from the main server. Each user DB has the main server in its
linked servers in order to be able to query the main server from the user DB
and compare data from both sides (to find the differences). Subsequent
updates are done using the same SQL queries. MDF files are stored on a
server that has SQL Express installed to which the app connects.
This solution works well but the problem is that each user DB update (near
300 Sql requests for 50 mb results DB) requires at least 30 seconds to
execute. 3000 users means 25 hours to complete the whole process. The main
server stay at low CPU level, but the "express" server quickly increase its
CPU usage (near 100% when 4 updating threads are working simultaneously),
but we cannot buy a 64 cpu computer ;).
We are looking for a faster solution. Do you have any idea which could help
us either to optimize our solution or even another method ?
We do not want to use the Sql Server replication because it is not
applicable in our environment.
Buying other SQL Server is possible but must be justified.
Thanks,
SteveSteve
> Our first idea is to create 3000 mdf files, one db for each user. This DB
> is created by copying a "model" db with the data structure, then using
Actually you have not explained what are you trying to achive?
What is if the data will be stored in one database? Where do user locate?
How do they access the database?
We have many customers installed on their workstations MSDE/EXPRESS and just
pushed the data (as a publisher) from pur main server . Yep , it is a
replication which sometimes has some problems that hard to solve.
"Steve B." <steve_beauge@.com.msn_swap_com_and_msn> wrote in message
news:%23%23SBw8nTGHA.6048@.TK2MSFTNGP11.phx.gbl...
> Hi,
> We have an SQL 2005 Server with the whole enterprise data.
> We are building an application that requires a per user database with its
> own data (horizontal filtering).
> Our first idea is to create 3000 mdf files, one db for each user. This DB
> is created by copying a "model" db with the data structure, then using
> SqlExpress's AttachDbFilename feature to connect to user db and fill it
> with filtered data from the main server. Each user DB has the main server
> in its linked servers in order to be able to query the main server from
> the user DB and compare data from both sides (to find the differences).
> Subsequent updates are done using the same SQL queries. MDF files are
> stored on a server that has SQL Express installed to which the app
> connects.
> This solution works well but the problem is that each user DB update (near
> 300 Sql requests for 50 mb results DB) requires at least 30 seconds to
> execute. 3000 users means 25 hours to complete the whole process. The main
> server stay at low CPU level, but the "express" server quickly increase
> its CPU usage (near 100% when 4 updating threads are working
> simultaneously), but we cannot buy a 64 cpu computer ;).
> We are looking for a faster solution. Do you have any idea which could
> help us either to optimize our solution or even another method ?
> We do not want to use the Sql Server replication because it is not
> applicable in our environment.
> Buying other SQL Server is possible but must be justified.
> Thanks,
> Steve
>|||The Sql express db are used to store an image of data that each user
require.
The actual "end user" application is a mobile application in which a sql
mobile DB is synchronized against a http application that will make all the
required work to ensure the sql mobile DB has exactly the same data than the
Sql express one.
This "intermediary" sql express db is required since the MS Merge
replication between sql 2005 and mobile device can't be used because of
replication limitations.
Since the main DB is quite big, we want to compute differences for each user
within the lan, before sending it to the device (that's why we want to use
mdf files that are exact copy of the data for the user, which is easier to
synchronize since it is 1-1 with the device).
Thanks,
Steve
"Uri Dimant" <urid@.iscar.co.il> a crit dans le message de news:
%23LSWwGoTGHA.4956@.TK2MSFTNGP09.phx.gbl...
> Steve
> Actually you have not explained what are you trying to achive?
> What is if the data will be stored in one database? Where do user locate?
> How do they access the database?
> We have many customers installed on their workstations MSDE/EXPRESS and
> just pushed the data (as a publisher) from pur main server . Yep , it is a
> replication which sometimes has some problems that hard to solve.
>
>
>
> "Steve B." <steve_beauge@.com.msn_swap_com_and_msn> wrote in message
> news:%23%23SBw8nTGHA.6048@.TK2MSFTNGP11.phx.gbl...
>

Need to update up to 3000 user DB

Hi,
We have an SQL 2005 Server with the whole enterprise data.
We are building an application that requires a per user database with its
own data (horizontal filtering).
Our first idea is to create 3000 mdf files, one db for each user. This DB is
created by copying a "model" db with the data structure, then using
SqlExpress's AttachDbFilename feature to connect to user db and fill it with
filtered data from the main server. Each user DB has the main server in its
linked servers in order to be able to query the main server from the user DB
and compare data from both sides (to find the differences). Subsequent
updates are done using the same SQL queries. MDF files are stored on a
server that has SQL Express installed to which the app connects.
This solution works well but the problem is that each user DB update (near
300 Sql requests for 50 mb results DB) requires at least 30 seconds to
execute. 3000 users means 25 hours to complete the whole process. The main
server stay at low CPU level, but the "express" server quickly increase its
CPU usage (near 100% when 4 updating threads are working simultaneously),
but we cannot buy a 64 cpu computer ;).
We are looking for a faster solution. Do you have any idea which could help
us either to optimize our solution or even another method ?
We do not want to use the Sql Server replication because it is not
applicable in our environment.
Buying other SQL Server is possible but must be justified.
Thanks,
Steve
Steve
> Our first idea is to create 3000 mdf files, one db for each user. This DB
> is created by copying a "model" db with the data structure, then using
Actually you have not explained what are you trying to achive?
What is if the data will be stored in one database? Where do user locate?
How do they access the database?
We have many customers installed on their workstations MSDE/EXPRESS and just
pushed the data (as a publisher) from pur main server . Yep , it is a
replication which sometimes has some problems that hard to solve.
"Steve B." <steve_beauge@.com.msn_swap_com_and_msn> wrote in message
news:%23%23SBw8nTGHA.6048@.TK2MSFTNGP11.phx.gbl...
> Hi,
> We have an SQL 2005 Server with the whole enterprise data.
> We are building an application that requires a per user database with its
> own data (horizontal filtering).
> Our first idea is to create 3000 mdf files, one db for each user. This DB
> is created by copying a "model" db with the data structure, then using
> SqlExpress's AttachDbFilename feature to connect to user db and fill it
> with filtered data from the main server. Each user DB has the main server
> in its linked servers in order to be able to query the main server from
> the user DB and compare data from both sides (to find the differences).
> Subsequent updates are done using the same SQL queries. MDF files are
> stored on a server that has SQL Express installed to which the app
> connects.
> This solution works well but the problem is that each user DB update (near
> 300 Sql requests for 50 mb results DB) requires at least 30 seconds to
> execute. 3000 users means 25 hours to complete the whole process. The main
> server stay at low CPU level, but the "express" server quickly increase
> its CPU usage (near 100% when 4 updating threads are working
> simultaneously), but we cannot buy a 64 cpu computer ;).
> We are looking for a faster solution. Do you have any idea which could
> help us either to optimize our solution or even another method ?
> We do not want to use the Sql Server replication because it is not
> applicable in our environment.
> Buying other SQL Server is possible but must be justified.
> Thanks,
> Steve
>
|||The Sql express db are used to store an image of data that each user
require.
The actual "end user" application is a mobile application in which a sql
mobile DB is synchronized against a http application that will make all the
required work to ensure the sql mobile DB has exactly the same data than the
Sql express one.
This "intermediary" sql express db is required since the MS Merge
replication between sql 2005 and mobile device can't be used because of
replication limitations.
Since the main DB is quite big, we want to compute differences for each user
within the lan, before sending it to the device (that's why we want to use
mdf files that are exact copy of the data for the user, which is easier to
synchronize since it is 1-1 with the device).
Thanks,
Steve
"Uri Dimant" <urid@.iscar.co.il> a crit dans le message de news:
%23LSWwGoTGHA.4956@.TK2MSFTNGP09.phx.gbl...
> Steve
> Actually you have not explained what are you trying to achive?
> What is if the data will be stored in one database? Where do user locate?
> How do they access the database?
> We have many customers installed on their workstations MSDE/EXPRESS and
> just pushed the data (as a publisher) from pur main server . Yep , it is a
> replication which sometimes has some problems that hard to solve.
>
>
>
> "Steve B." <steve_beauge@.com.msn_swap_com_and_msn> wrote in message
> news:%23%23SBw8nTGHA.6048@.TK2MSFTNGP11.phx.gbl...
>