Showing posts with label generated. Show all posts
Showing posts with label generated. Show all posts

Sunday, March 25, 2012

Attach an aspnet or sql2005 database on a sql2000 server

Hello

I want to attach an ASPNETDB database (generated by the asp.net login wizard system), which is a sql2005 .mdf database I think, to our SQL2000 server.

I tried to attach the file directly ; then to attach it to a sql2005 express server, "turning it" into a sql2000 database via the properties, then make a backup, then restore the backup on the 2000 server ; nothing worked out !
One of the method I tried (I don't remember which one) told me it could'nt read the sysindexes table ; of course, because there isn't such table on sql2005 databases.

So, is there a way to attach a SQL2005 database (so with no or few system tables) to a SQL2000 server (which requires those tables), or to re-generate the ASPNETDB in the SQL2000 format ?
If I re-create the syssomething tables on the SQL2005 database, will it work that simply ?

At the very last, I may have to install SQL express on the server. If there is already a SQL2000 server on the machine, will it cohabit with no problem ? Is the SQL express server ready for a production server with light or medium load ?

Thanks a lot, and sorry for so many questions ! :)

Hi,

"I want to attach an ASPNETDB database (generated by the asp.net login wizard system), which is a sql2005 .mdf database I think, to our SQL2000 server."

-That′s not working, the format is different to SQL Server 2k5, there is no backward compatibility.

""turning it" into a sql2000 database"

-Making the compatibility level to 2000 doesn't mean that the database is 2000 ready, it just behaves on a SQL2k5 machine like a SQL 2k database.

You will either have to script the object and the data out or bcp the data out or use any wizard to transfer the objects to the other SQL 2000 Server machine.

HTH, Jens Suessmeyer.

http://www.sqlserver2005.de

|||Ok, and if I export the database structure as a SQL script, will it just work ?

And for the SQL2005 Express server, is it usable along with the SQL2000 server, and does it fits for a ligt-load production server ?

thanks !
|||

Hi,

sure as long as you don′t use any new features of SQL Server 2005 and you take care of the difference of schema and owner you should be fine.

SQL 2k and SQL2k5X is working together. It can be also used as a light load production server (whatever that means in your case :-) ), it is only limited by the limitations of SQL Server Express, no query governor or anything else.

HTH, jens Suessmeyer.

http://www.sqlserver2005.de

Thursday, March 22, 2012

async_network_io wait during replication

I have re-initialize some subscription. After generated snapshot successfully, the synchronization view showing 'The process is running and is waiting for a response from the server.' and I found the replication process is under 'async_network_io wait'. The job has run for more than 8 hrs. Any idea to improve it? Thanks in advaise.

Are you running the sync agent (like merge agent/distribution agent) in continuous mode? If yes, it will show running forever, although the submitted transactions/commands have been replicated, agent job is just keeping waiting for next actions.

Thanks

-Yunjing

|||Yes, in continuous mode. But the replication hadn't completed in 8 hrs. Any idea? Thanks|||

If an continuous sync complete for a session, its current history log usually shows something like "No replicated transactions are available" and sync job is still showing as running.

As for your case, could you open sqlmonitor to check the current status for the job, is it still running or fail already? If it's running, what's the current history shown? Does the history get updated every a few minutes?

-Yunjing

Tuesday, March 20, 2012

Association model prediction not using itemsets

I have a market basket model using associations. It generated several dozen itemsets. However when I attempt to run a singleton prediction like this:

select (Predict(Orderproduct3q,INCLUDE_STATISTICS,10)) as [Recommendation]

From

[Case All]

NATURAL PREDICTION JOIN

(SELECT (SELECT '16407' AS [Pname])) AS t1

the resulting predictions don't take the itemsets into account. Instead, the predictions consist of the ranked products in the training set, ordered by frequency. This appears to happen regardless of the precise query specified within the "natural prediction join".

What's going on here and how do I generate a singleton prediction which makes use of the itemsets?

The nested table inside the input should have the same name as the nested table of the model, for Natural prediction Join. Could you please try this:

select (Predict(Orderproduct3q,INCLUDE_STATISTICS,10)) as [Recommendation]

From

[Case All]

NATURAL PREDICTION JOIN

(SELECT (SELECT '16407' AS [Pname]) AS Orderproduct3q ) AS t1

Otherwise, the input rowset (t1) contains an unnamed nested table which cannot be mapped to your model's table

|||

Thanks for the suggestion, which was on the right lines. Something like this does now pick up one of the itemsets.

select (Predict(Orderproduct3q,INCLUDE_STATISTICS,10)) as [Recommendation]

From

[Case All]

NATURAL PREDICTION JOIN
(SELECT (SELECT '17717' AS Pname Union SELECT '16415' AS Pname) as Orderproduct3q ) AS t1

|||Also look at the tip/trick at http://www.sqlserverdatamining.com/DMCommunity/TipsNTricks/3514.aspxsql

Thursday, March 8, 2012

Assign records to Analysts

Here is my issue. I have a list of merchants (generated daily) and I
need to assign them eually to a set of analysts. Both the merchant
list and analyst list can change daily. I want to assign each merchant
with an analyst daily and need help to write out a stored procedure
for this (do not want to use VB).
Here is relevant code for the tables:
CREATE TABLE MerchList (
MerchListID int IDENTITY (1, 1) NOT NULL ,
FileDate datetime NOT NULL ,
MerchID int NOT NULL ,
AnalystID int NOT NULL ,
)

CREATE TABLE tblAnalyst (
AnalystID int IDENTITY (1, 1) NOT NULL ,
AnalystName varchar(100) NOT NULL
)

there will be about 10000 records in table MerchList and around 25
records in table tblAnalyst.

This will be used to assign work to analysts on a daily basis.

Thanks for all your help!

Vishal"Vishal Sinha" <vsinha73@.yahoo.com> wrote in message
news:2f4d7b0a.0401121129.40ee0b82@.posting.google.c om...
> Here is my issue. I have a list of merchants (generated daily) and I
> need to assign them eually to a set of analysts. Both the merchant
> list and analyst list can change daily. I want to assign each merchant
> with an analyst daily and need help to write out a stored procedure
> for this (do not want to use VB).
> Here is relevant code for the tables:
> CREATE TABLE MerchList (
> MerchListID int IDENTITY (1, 1) NOT NULL ,
> FileDate datetime NOT NULL ,
> MerchID int NOT NULL ,
> AnalystID int NOT NULL ,
> )
> CREATE TABLE tblAnalyst (
> AnalystID int IDENTITY (1, 1) NOT NULL ,
> AnalystName varchar(100) NOT NULL
> )
> there will be about 10000 records in table MerchList and around 25
> records in table tblAnalyst.
> This will be used to assign work to analysts on a daily basis.
> Thanks for all your help!
> Vishal

Your requirements aren't entirely clear (at least to me), and the tables
don't seem to have enough information (keys and constraints) to give a good
answer. Is the MerchList table repopulated every day, or are today's
merchants identified by FileDate? Can the same MerchID appear multiple times
in one day (if that is what FileDate is for)? Is the tblAnalyst table
repopulated every day? If so, then how do you track AnalystIDs over time? If
it is not, then how do you mark analysts as sick or unavailable (there seems
to be no column for that)?

Your basic requirement seems to be assigning merchants to analysts, but it
isn't clear what you mean by "equally". What happens if some analysts can
process more merchants than others, due to greater experience, better
resources or whatever? In that case, you would want to weight the
assignment, so they get more merchants assigned to them. Or what happens if
the numbers simply don't divide into each other cleanly - who gets the
'extra' merchants?

And do you have to ensure that merchants are 'rotated' among analysts, or is
it acceptable for the same merchant to be assigned to the same analyst every
day indefinitely? If you need rotation, should it be random or periodic? Are
there rules about merchants which can never be assigned to certain
analysts - a blacklist or Chinese wall?

I don't want to sound unhelpful, but I suspect you may be oversimplifying
your requirements, and if you do need to consider some of the issues I've
suggested, then it's likely that you'll end up with something too detailed
to discuss in a newsgroup.

But if it is a simple case, then I think you'll get more help by providing
some sample data, preferably for at least a couple of different days. That
should help clarify what you expect to achieve.

Simon|||Thanks for the quick response,
Please see my replies below:

Re: Assign records to Analysts
From: Simon Hayes
Date Posted: 1/12/2004 1:43:00 PM

Your requirements aren't entirely clear (at least to me), and the tables
don't seem to have enough information (keys and constraints) to give a
good answer. Is the MerchList table repopulated every day, or are
today's merchants identified by FileDate? Can the same MerchID appear
multiple times in one day (if that is what FileDate is for)? Is the
tblAnalyst table repopulated every day? If so, then how do you track
AnalystIDs over time? If
it is not, then how do you mark analysts as sick or unavailable (there
seems to be no column for that)?

Vishal>> There is one record per mechant and the list is created on a
daily basis. so the table would have data for multiple dates where there
can be only one record for a merchant for any given date.

Your basic requirement seems to be assigning merchants to analysts, but
it isn't clear what you mean by "equally". What happens if some analysts
can process more merchants than others, due to greater experience,
better
resources or whatever? In that case, you would want to weight the
assignment, so they get more merchants assigned to them. Or what happens
if the numbers simply don't divide into each other cleanly - who gets
the
'extra' merchants?

Vishal>> I would need to assign equal number of merchants to analysts.
If the numbers do not divide equally then the first few get the extra
(can be order by ID - does not matter)

And do you have to ensure that merchants are 'rotated' among analysts,
or is it acceptable for the same merchant to be assigned to the same
analyst every day indefinitely? If you need rotation, should it be
random or periodic? Are
there rules about merchants which can never be assigned to certain
analysts - a blacklist or Chinese wall?

Vishal>> No rotation required

I don't want to sound unhelpful, but I suspect you may be
oversimplifying
your requirements, and if you do need to consider some of the issues
I've
suggested, then it's likely that you'll end up with something too
detailed
to discuss in a newsgroup.

But if it is a simple case, then I think you'll get more help by
providing
some sample data, preferably for at least a couple of different days.
That
should help clarify what you expect to achieve.

Simon

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!|||Vishal Sinha (vsinha73@.yahoo.com) writes:
> Here is my issue. I have a list of merchants (generated daily) and I
> need to assign them eually to a set of analysts. Both the merchant
> list and analyst list can change daily. I want to assign each merchant
> with an analyst daily and need help to write out a stored procedure
> for this (do not want to use VB).
> Here is relevant code for the tables:
> CREATE TABLE MerchList (
> MerchListID int IDENTITY (1, 1) NOT NULL ,
> FileDate datetime NOT NULL ,
> MerchID int NOT NULL ,
> AnalystID int NOT NULL ,
> )
> CREATE TABLE tblAnalyst (
> AnalystID int IDENTITY (1, 1) NOT NULL ,
> AnalystName varchar(100) NOT NULL
> )
> there will be about 10000 records in table MerchList and around 25
> records in table tblAnalyst.

If I understood the requirements from your supplemental posting
correctly, this could be a solution:

UPDATE MerchList
SET AnalystID = MerchListID %
(SELECT COUNT(*) FROM tblAnalyst) + 1

This presumes that the AnalystIDs goes from 1 to 25 (or whatever)
without gaps. If there are gaps, or the id:s do not start at 1,
you could do:

CREATE TABLE #analystmap (id int IDENTITY(0, 1),
analystid int NOT NULL

INSERT #analystmap (analystid)
SELECT AnalystID FROM tblAnalyst ORDER BY newid()

UPDATE MerchList
SET AnalystID = a.analystid
FROM MerchList m
JOIN #analystmap a ON
m.MerchList % (SELECT COUNT(*) FROM #analystmap) = a.id

The ORDER BY newid() adds a certain randomness into the process, but
still merchants that are 25 ids apart will get the same analyst.

Disclaimer: as there was not test data included, I have not tested this.

--
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se

Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techin.../2000/books.asp|||Your schema has no keys, no DRI and no constraints. You will also
have no data integrity. Let's fix it up:

CREATE TABLE MerchAnalysts
(file_date DATETIME NOT NULL,
REFERENCES Analysts (analyst_id),
merch_id INTEGER NOT NULL
REFERENCES Merchants (merch_id),
analyst_id INTEGER NOT NULL,
REFERENCES Analysts (analyst_id),
..
PRIMARY KEY (file_date, analyst_id, merch_id));

Since I do not know what the **real keys** for merchants and analysts
would be (SSN? Tax number, DUN number?), I have left them as
INTEGERs; fix this omission immediately! IDENTITY is never a key. I
also shortened the names to a length that will not collect garbage
strings or be so long they cannot display easily, etc.

CREATE TABLE Analysts
(analyst_id INTEGER NOT NULL PRIMARY KEY,
analyst_name VARCHAR(35) NOT NULL,
..);

CREATE TABLE Merchants
(merch_id INTEGER NOT NULL PRIMARY KEY,
analyst_name VARCHAR(35) NOT NULL,
..);

>> I want to assign each merchant with an analyst daily and need help
to write out a stored procedure for this <<

What is the rule for the assignments? To write a procedure, we need
to have a spec. Do you want to divide them up evenly each day? Are
certain analysts assigned to certain merchants, but have an
alternative analyst if the primary one is not at work? Are the rules
more complex than that either of those possibilities?|||Thanks for the Suggestions - it is EXACTLY what I needed. I did post a
rather simplified version of table design for illustration purposes.

Thanks everyone!

Vishal

Erland Sommarskog <sommar@.algonet.se> wrote in message news:<Xns946EF0EF2F3F4Yazorman@.127.0.0.1>...
> Vishal Sinha (vsinha73@.yahoo.com) writes:
> > Here is my issue. I have a list of merchants (generated daily) and I
> > need to assign them eually to a set of analysts. Both the merchant
> > list and analyst list can change daily. I want to assign each merchant
> > with an analyst daily and need help to write out a stored procedure
> > for this (do not want to use VB).
> > Here is relevant code for the tables:
> > CREATE TABLE MerchList (
> > MerchListID int IDENTITY (1, 1) NOT NULL ,
> > FileDate datetime NOT NULL ,
> > MerchID int NOT NULL ,
> > AnalystID int NOT NULL ,
> > )
> > CREATE TABLE tblAnalyst (
> > AnalystID int IDENTITY (1, 1) NOT NULL ,
> > AnalystName varchar(100) NOT NULL
> > )
> > there will be about 10000 records in table MerchList and around 25
> > records in table tblAnalyst.
> If I understood the requirements from your supplemental posting
> correctly, this could be a solution:
> UPDATE MerchList
> SET AnalystID = MerchListID %
> (SELECT COUNT(*) FROM tblAnalyst) + 1
> This presumes that the AnalystIDs goes from 1 to 25 (or whatever)
> without gaps. If there are gaps, or the id:s do not start at 1,
> you could do:
> CREATE TABLE #analystmap (id int IDENTITY(0, 1),
> analystid int NOT NULL
> INSERT #analystmap (analystid)
> SELECT AnalystID FROM tblAnalyst ORDER BY newid()
> UPDATE MerchList
> SET AnalystID = a.analystid
> FROM MerchList m
> JOIN #analystmap a ON
> m.MerchList % (SELECT COUNT(*) FROM #analystmap) = a.id
> The ORDER BY newid() adds a certain randomness into the process, but
> still merchants that are 25 ids apart will get the same analyst.
> Disclaimer: as there was not test data included, I have not tested this.

Friday, February 24, 2012

aspnet_regsql.exe and generated SQL

Where is the sql generated byaspnet_regsql.exe saved?

It can be found in App_Code folder as mdf and ldf files. If you are using VS 2005 then refresh the solution explorer to show the App_Code folder and the database.|||Oops its not App_Code but App_Data folder!!!!