Showing posts with label store. Show all posts
Showing posts with label store. Show all posts

Monday, March 26, 2012

How to reinitialize when "There is a problem with your selected data store"?

I've been trying to reinitialize the membership database, but something stops me.

I have tried deleting aspnetdb.mdf from the App_Data folder. This works fine, and then a new one is created when I use the asp.net adminstration tool. I can use the server explorer to view the table content (all null).

Although I can open the asp.net configuration page, the problem occurs when I select security. Then I get the error

There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store.

The following message may help in diagnosing the problem:Database 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\asp.netwebadminfiles\App_Data\ASPNETDB.MDF' already exists. Could not attach file 'C:\Documents and Settings\Jeff Leese\My Documents\world\my work\current\counsellor\App_Data\ASPNETDB.MDF' as database 'ASPNETDB_devjeffleese'.

All this seems to have happened after I modified my connection info in the web.config file:

<connectionStrings>

<removename="LocalSqlServer"/>

<addname="LocalSqlServer"connectionString="Data Source=.\SQLEXPRESS; AttachDbFilename=|DataDirectory|\ASPNETDB.MDF; user instance=true; Integrated Security=True; Initial Catalog=ASPNETDB_devjeffleese;"

providerName="System.Data.SqlClient" />

</connectionStrings>

So, two questions:

1) What are the sections about? They seem to have been inserted automatically at some point, and I wonder if its just formatting info or should I remove them?

2) How can I get security going again. How do I deal with the 'already exists' problem that prevents 'attaching' ?

Would greatly appreciate guidance in how to start over...

Hi,

I had a similar problem with the install of the ASPNET DB, and I'll try to recall how I got it running.

What I tried first was to hae the DB istalled automatically from the WS I have running VS 2005, which is networked to a server running SQL Server 2005 (Standard). I wanted the DB installed on that SQL Server instance, but ran into problem. Even pre-creating the DB ther didn't seem to help. I'm not saying it can't be done, but it wasn't worth the effort to me. I DL'ed and installed an instance of SQL Server Express on the WS that has VS, did the aspnet_regsql.exe, and things worked Ok. I figure I can transfer the DB to the full SQL Server when/if I need to, but where it is is fine for development work. (Side note: I installed the Full version client tools on the WS, so I'd have these, rather than the Expess manager - but getting the uninstall/install sequence right was a hassle).

I didn't see a mention of aspnet_regsql.exe in your post. If you havent used it, do a search on msdn.microsoft.com for how and why to use it. You should find it in your Windows\Microsoft.net\Framework\(the version you are running). You should find it there, in the same place as the reg for IIS (if you need that too).

Good luck, hop eit helps. BRN..

Friday, March 9, 2012

how to read the query in store procedure

i wrote a stored procedure here is the code

CREATE Procedure dm_deleteBBPost
(
@.TopicIDnumeric,
@.ForumIDnumeric

)
As
declare @.netCount as int

BEGIN
Select @.netCount=count(*) from tablename where TopicID=@.TopicID

update tablename set TotalTopics=TotalTopics-1,TotalPosts=TotalPosts-@.netCount where ForumID=@.ForumID

Delete From tblBBPosts Where TopicID = @.TopicID
Delete From tblBBTopics Where TopicID =@.TopicID

end
declare @.pr_ForumsToday as varchar

////////// select Top 1 * from tablename order by column name desc
GO

IN that last line one row will be displayed. how can i read one of the field from the query (selct top1 etc)

Quote:

Originally Posted by madhu7sudan

i wrote a stored procedure here is the code

CREATE Procedure dm_deleteBBPost
(
@.TopicIDnumeric,
@.ForumIDnumeric

)
As
declare @.netCount as int

BEGIN
Select @.netCount=count(*) from tablename where TopicID=@.TopicID

update tablename set TotalTopics=TotalTopics-1,TotalPosts=TotalPosts-@.netCount where ForumID=@.ForumID

Delete From tblBBPosts Where TopicID = @.TopicID
Delete From tblBBTopics Where TopicID =@.TopicID

end
declare @.pr_ForumsToday as varchar

////////// select Top 1 * from tablename order by column name desc
GO

IN that last line one row will be displayed. how can i read one of the field from the query (selct top1 etc)


Try this...

SELECT TOP 1 COLUMNNAME FROM TABLENAME ORDER BY COLUMN NAME DESC

Wednesday, March 7, 2012

How to read contents of text file from t-sql ?

Hi friends,
I need to read content of text file and store them in
string variable in my store procedure, Is there t-sql or
function to read content of text file ?
Thanks.There is no direct set of functions to do it, but you could use the sp_OA*
set of procedures to access the file. For an example of how to use these
procedures see:
http://www32.brinkster.com/srisamp/sqlArticles/article_32.htm
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"Kresna Rudy Kurniawan" <kresna_rk@.yahoo.com> wrote in message
news:081001c3a377$c35948b0$a601280a@.phx.gbl...
> Hi friends,
> I need to read content of text file and store them in
> string variable in my store procedure, Is there t-sql or
> function to read content of text file ?
>
> Thanks.

how to read and store a large file from SQL Server 2000?

hi..

I want to store a RMVB file to SQL SERVER 2000 ,and read from it,iwant to play the RMVB file in web,the size of the RMVB file is more than 300MB less 1G.the SQL FieldImage can include it.

Now My Quesstion is How can i Store and Read the RMVB file from SQL Server2000?

I usedSqlInsertCommand.ExecuteNoquery() in my program,but it Too slow,ao make a unknown error.

Thank you for your help.

I would seriously recomend not putting stuff like this into your db. Store a hard link to the file in your db, and put the file in the file system where it belongs. Binary data in your db of that size is only going to slow down every db operation you hope to accomplish.

|||And if you don't even execute the database functions it is fast enough and you don't get any errors?|||

thanks

I try it as you say,the code is:<embed src="http://pics.10026.com/?src=a.rmvb" height=200 width=200>but when it run,there are error Message:"the link of http://x.x.x.x/a.rmvb" is timeout or wrong" but the a.rmvb is realy in there and the link time is less then 1 second.

where is wong?thanks for your help!

|||

Please post your entire set of code that inserts this item into a database so we can troubleshoot it.

|||

hi..

the code is that:

WebForm1 -->WebForm1 -->WebForm1 --> body MS_POSITIONING="GridLayout"

form id="Form1" method="post" runat="server"

embed src="http://pics.10026.com/?src=Request["path"]" width=200 height=200>/embed

/form>

/body>

the path=a.rmvb

and when it run in localhost it is all right,but when it is wrong in server(the server not install realplay software)

where is wrong ?

thanks for your help!

|||

hi..

when i install realply in the server,it is all ok!

Sunday, February 19, 2012

How to query data through scheduled tasks

Hello,
We are currently using an inventory control system that is a little lacking.
It allows us to store expiration dates for our materials but lacks any way t
o
use the information. The system is built on an MSSQL 2000 database.
What I would like to do is write a program to place into the Windows
scheduled tasks to run once a day. The app needs to compare the exp. date
field in the table to the current date. If the date is within two weeks or
less of the current date I want to generate an e-mail notification or pop up
message to send to a selected group of internal users. Everyone has an
external e-mail account so I can send directly with an smtp engine.
Has anyone else tried or purchased something that could do this? If not then
what language would be recommended that is capable of doing this on a
schedule basis? If this can be done in SQL then it is simply beyond my
abilities so I would be looking for a contractor to program it.
Our network is running on Server 2000. I run Merak mail server and Goldmine
CRM/e-mail client. All local machines are windows with IE.
Thanks for your assistance.
LWhite> What I would like to do is write a program to place into the Windows
> scheduled tasks to run once a day. The app needs to compare the exp. date
> field in the table to the current date. If the date is within two weeks or
> less of the current date I want to generate an e-mail notification or pop
up
> message to send to a selected group of internal users. Everyone has an
> external e-mail account so I can send directly with an smtp engine.
Sounds like a pretty simple thing to do with SQL Server Agent (keeping the
rules and logic inside the database) and a simple mailing product like
xp_smtp_sendmail. You won't need Windows Scheduled Tasks... let us know if
you have any questions after reading http://www.aspfaq.com/2403
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.|||"LWhite" wrote:

> Hello,
> We are currently using an inventory control system that is a little lackin
g.
> It allows us to store expiration dates for our materials but lacks any way
to
> use the information. The system is built on an MSSQL 2000 database.
> What I would like to do is write a program to place into the Windows
> scheduled tasks to run once a day. The app needs to compare the exp. date
> field in the table to the current date. If the date is within two weeks or
> less of the current date I want to generate an e-mail notification or pop
up
> message to send to a selected group of internal users. Everyone has an
> external e-mail account so I can send directly with an smtp engine.
> Has anyone else tried or purchased something that could do this? If not th
en
> what language would be recommended that is capable of doing this on a
> schedule basis? If this can be done in SQL then it is simply beyond my
> abilities so I would be looking for a contractor to program it.
> Our network is running on Server 2000. I run Merak mail server and Goldmin
e
> CRM/e-mail client. All local machines are windows with IE.
> Thanks for your assistance.
> LWhite
I would use a SQL Server to schedule a job to kick off a task which executes
a sproc like the one below...assuming you can have SQL Mail installed:
create procedure spNotifyProductExpiration
as
begin
declare @.vcSQL varchar(8000)
select @.vcSQL = 'select productname,
abs(datediff(dd,expirationdate,getdate()
)) as ExpireDays from stuff where
abs(datediff(dd,expirationdate,getdate()
)) <= 15'
exec master..xp_sendmail @.recipient='manager@.yourcompany.com',
@.subject='Expirations',
@.query = @.vcSQL, @.message='These products will
be expiring soon!'
end

How to query data through scheduled tasks

Hello,
We are currently using an inventory control system that is a little lacking.
It allows us to store expiration dates for our materials but lacks any way to
use the information. The system is built on an MSSQL 2000 database.
What I would like to do is write a program to place into the Windows
scheduled tasks to run once a day. The app needs to compare the exp. date
field in the table to the current date. If the date is within two weeks or
less of the current date I want to generate an e-mail notification or pop up
message to send to a selected group of internal users. Everyone has an
external e-mail account so I can send directly with an smtp engine.
Has anyone else tried or purchased something that could do this? If not then
what language would be recommended that is capable of doing this on a
schedule basis? If this can be done in SQL then it is simply beyond my
abilities so I would be looking for a contractor to program it.
Our network is running on Server 2000. I run Merak mail server and Goldmine
CRM/e-mail client. All local machines are windows with IE.
Thanks for your assistance.
LWhite
> What I would like to do is write a program to place into the Windows
> scheduled tasks to run once a day. The app needs to compare the exp. date
> field in the table to the current date. If the date is within two weeks or
> less of the current date I want to generate an e-mail notification or pop
up
> message to send to a selected group of internal users. Everyone has an
> external e-mail account so I can send directly with an smtp engine.
Sounds like a pretty simple thing to do with SQL Server Agent (keeping the
rules and logic inside the database) and a simple mailing product like
xp_smtp_sendmail. You won't need Windows Scheduled Tasks... let us know if
you have any questions after reading http://www.aspfaq.com/2403
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.
|||"LWhite" wrote:

> Hello,
> We are currently using an inventory control system that is a little lacking.
> It allows us to store expiration dates for our materials but lacks any way to
> use the information. The system is built on an MSSQL 2000 database.
> What I would like to do is write a program to place into the Windows
> scheduled tasks to run once a day. The app needs to compare the exp. date
> field in the table to the current date. If the date is within two weeks or
> less of the current date I want to generate an e-mail notification or pop up
> message to send to a selected group of internal users. Everyone has an
> external e-mail account so I can send directly with an smtp engine.
> Has anyone else tried or purchased something that could do this? If not then
> what language would be recommended that is capable of doing this on a
> schedule basis? If this can be done in SQL then it is simply beyond my
> abilities so I would be looking for a contractor to program it.
> Our network is running on Server 2000. I run Merak mail server and Goldmine
> CRM/e-mail client. All local machines are windows with IE.
> Thanks for your assistance.
> LWhite
I would use a SQL Server to schedule a job to kick off a task which executes
a sproc like the one below...assuming you can have SQL Mail installed:
create procedure spNotifyProductExpiration
as
begin
declare @.vcSQL varchar(8000)
select @.vcSQL = 'select productname,
abs(datediff(dd,expirationdate,getdate())) as ExpireDays from stuff where
abs(datediff(dd,expirationdate,getdate())) <= 15'
exec master..xp_sendmail @.recipient='manager@.yourcompany.com',
@.subject='Expirations',
@.query = @.vcSQL, @.message='These products will
be expiring soon!'
end

How to query data through scheduled tasks

Hello,
We are currently using an inventory control system that is a little lacking.
It allows us to store expiration dates for our materials but lacks any way to
use the information. The system is built on an MSSQL 2000 database.
What I would like to do is write a program to place into the Windows
scheduled tasks to run once a day. The app needs to compare the exp. date
field in the table to the current date. If the date is within two weeks or
less of the current date I want to generate an e-mail notification or pop up
message to send to a selected group of internal users. Everyone has an
external e-mail account so I can send directly with an smtp engine.
Has anyone else tried or purchased something that could do this? If not then
what language would be recommended that is capable of doing this on a
schedule basis? If this can be done in SQL then it is simply beyond my
abilities so I would be looking for a contractor to program it.
Our network is running on Server 2000. I run Merak mail server and Goldmine
CRM/e-mail client. All local machines are windows with IE.
Thanks for your assistance.
LWhite> What I would like to do is write a program to place into the Windows
> scheduled tasks to run once a day. The app needs to compare the exp. date
> field in the table to the current date. If the date is within two weeks or
> less of the current date I want to generate an e-mail notification or pop
up
> message to send to a selected group of internal users. Everyone has an
> external e-mail account so I can send directly with an smtp engine.
Sounds like a pretty simple thing to do with SQL Server Agent (keeping the
rules and logic inside the database) and a simple mailing product like
xp_smtp_sendmail. You won't need Windows Scheduled Tasks... let us know if
you have any questions after reading http://www.aspfaq.com/2403
--
Please post DDL, sample data and desired results.
See http://www.aspfaq.com/5006 for info.|||"LWhite" wrote:
> Hello,
> We are currently using an inventory control system that is a little lacking.
> It allows us to store expiration dates for our materials but lacks any way to
> use the information. The system is built on an MSSQL 2000 database.
> What I would like to do is write a program to place into the Windows
> scheduled tasks to run once a day. The app needs to compare the exp. date
> field in the table to the current date. If the date is within two weeks or
> less of the current date I want to generate an e-mail notification or pop up
> message to send to a selected group of internal users. Everyone has an
> external e-mail account so I can send directly with an smtp engine.
> Has anyone else tried or purchased something that could do this? If not then
> what language would be recommended that is capable of doing this on a
> schedule basis? If this can be done in SQL then it is simply beyond my
> abilities so I would be looking for a contractor to program it.
> Our network is running on Server 2000. I run Merak mail server and Goldmine
> CRM/e-mail client. All local machines are windows with IE.
> Thanks for your assistance.
> LWhite
I would use a SQL Server to schedule a job to kick off a task which executes
a sproc like the one below...assuming you can have SQL Mail installed:
create procedure spNotifyProductExpiration
as
begin
declare @.vcSQL varchar(8000)
select @.vcSQL = 'select productname,
abs(datediff(dd,expirationdate,getdate())) as ExpireDays from stuff where
abs(datediff(dd,expirationdate,getdate())) <= 15'
exec master..xp_sendmail @.recipient='manager@.yourcompany.com',
@.subject='Expirations',
@.query = @.vcSQL, @.message='These products will
be expiring soon!'
end

How to query children of a given node?

I'm new to SQLXML extenions and I'm curious if SQL Server
can handle what I need.
I need to store a tree data structure and I need to query
the children within a particular or multiple branches of
this tree. For example:
<Root>
<Branch Id=0,State=GA,Level=SpecialLevel/>
<Child Id=1,State=FL,Level=Grant/>
<Child Id=2,State=CA,Level=Denied/>
<Branch Id=3,State=WY,Level=NONE/>
<Child Id=4,State=TN,Level=Basic/>
<Root/>
My goal would like something like this I guess:
{
SELECT Id, State, Level
FROM RootTable
WHERE Root.Branch.Id = 0
}
I of course need to support the basics too:
- Create new tree
- Create new branch within existing tree
- Add/Update/Delete children and branches independent of
the other nodes
I can implement all of these features in C++ using a
standard DOM library. But, I'd love to get the powerful
querying capabilities of SQL along with the easy and
reliable admin functions.
I'm essentially hanging my decision to use a hand-coded
C++ XML server vs using SQL with XML extensions on the
querying capabilities that I need. From what I've read so
far, it seems pretty doable that SQLXML can handle the
insert, modify and delete operations. But, I'm not sure
about the querying capability.
Any help would be Greatly Appreciated :)!!
ChrisDepending on the shaping/filtering requirement you can either use XPath
against annotated schema or you can use FOR XML on the relational form (and
OpenXML or annotated schemas to store and update).
HTH
Michael
"ChrisD" <christopher_douglass@.deletethis.yahooDOTcom> wrote in message
news:1bce01c5056f$700cc140$a401280a@.phx.gbl...
> I'm new to SQLXML extenions and I'm curious if SQL Server
> can handle what I need.
> I need to store a tree data structure and I need to query
> the children within a particular or multiple branches of
> this tree. For example:
> <Root>
> <Branch Id=0,State=GA,Level=SpecialLevel/>
> <Child Id=1,State=FL,Level=Grant/>
> <Child Id=2,State=CA,Level=Denied/>
> <Branch Id=3,State=WY,Level=NONE/>
> <Child Id=4,State=TN,Level=Basic/>
> <Root/>
> My goal would like something like this I guess:
> {
> SELECT Id, State, Level
> FROM RootTable
> WHERE Root.Branch.Id = 0
> }
> I of course need to support the basics too:
> - Create new tree
> - Create new branch within existing tree
> - Add/Update/Delete children and branches independent of
> the other nodes
> I can implement all of these features in C++ using a
> standard DOM library. But, I'd love to get the powerful
> querying capabilities of SQL along with the easy and
> reliable admin functions.
> I'm essentially hanging my decision to use a hand-coded
> C++ XML server vs using SQL with XML extensions on the
> querying capabilities that I need. From what I've read so
> far, it seems pretty doable that SQLXML can handle the
> insert, modify and delete operations. But, I'm not sure
> about the querying capability.
> Any help would be Greatly Appreciated :)!!
> Chris|||Where do I find query examples using either or both
methods? Thanks!

>--Original Message--
>Depending on the shaping/filtering requirement you can
either use XPath
>against annotated schema or you can use FOR XML on the
relational form (and
>OpenXML or annotated schemas to store and update).
>HTH
>Michael
>"ChrisD" <christopher_douglass@.deletethis.yahooDOTcom>
wrote in message
>news:1bce01c5056f$700cc140$a401280a@.phx.gbl...
Server
query
so
>
>.
>|||Books Online (the SQL Server documentation) or www.sqlxml.org are two good
places to start.
Best regards
Michael
"Chris Douglass" <anonymous@.discussions.microsoft.com> wrote in message
news:1f4b01c5061f$19d99590$a401280a@.phx.gbl...
> Where do I find query examples using either or both
> methods? Thanks!
>
> either use XPath
> relational form (and
> wrote in message
> Server
> query
> so

How to query children of a given node?

I'm new to SQLXML extenions and I'm curious if SQL Server
can handle what I need.
I need to store a tree data structure and I need to query
the children within a particular or multiple branches of
this tree. For example:
<Root>
<Branch Id=0,State=GA,Level=SpecialLevel/>
<Child Id=1,State=FL,Level=Grant/>
<Child Id=2,State=CA,Level=Denied/>
<Branch Id=3,State=WY,Level=NONE/>
<Child Id=4,State=TN,Level=Basic/>
<Root/>
My goal would like something like this I guess:
{
SELECT Id, State, Level
FROM RootTable
WHERE Root.Branch.Id = 0
}
I of course need to support the basics too:
- Create new tree
- Create new branch within existing tree
- Add/Update/Delete children and branches independent of
the other nodes
I can implement all of these features in C++ using a
standard DOM library. But, I'd love to get the powerful
querying capabilities of SQL along with the easy and
reliable admin functions.
I'm essentially hanging my decision to use a hand-coded
C++ XML server vs using SQL with XML extensions on the
querying capabilities that I need. From what I've read so
far, it seems pretty doable that SQLXML can handle the
insert, modify and delete operations. But, I'm not sure
about the querying capability.
Any help would be Greatly Appreciated !!
Chris
Depending on the shaping/filtering requirement you can either use XPath
against annotated schema or you can use FOR XML on the relational form (and
OpenXML or annotated schemas to store and update).
HTH
Michael
"ChrisD" <christopher_douglass@.deletethis.yahooDOTcom> wrote in message
news:1bce01c5056f$700cc140$a401280a@.phx.gbl...
> I'm new to SQLXML extenions and I'm curious if SQL Server
> can handle what I need.
> I need to store a tree data structure and I need to query
> the children within a particular or multiple branches of
> this tree. For example:
> <Root>
> <Branch Id=0,State=GA,Level=SpecialLevel/>
> <Child Id=1,State=FL,Level=Grant/>
> <Child Id=2,State=CA,Level=Denied/>
> <Branch Id=3,State=WY,Level=NONE/>
> <Child Id=4,State=TN,Level=Basic/>
> <Root/>
> My goal would like something like this I guess:
> {
> SELECT Id, State, Level
> FROM RootTable
> WHERE Root.Branch.Id = 0
> }
> I of course need to support the basics too:
> - Create new tree
> - Create new branch within existing tree
> - Add/Update/Delete children and branches independent of
> the other nodes
> I can implement all of these features in C++ using a
> standard DOM library. But, I'd love to get the powerful
> querying capabilities of SQL along with the easy and
> reliable admin functions.
> I'm essentially hanging my decision to use a hand-coded
> C++ XML server vs using SQL with XML extensions on the
> querying capabilities that I need. From what I've read so
> far, it seems pretty doable that SQLXML can handle the
> insert, modify and delete operations. But, I'm not sure
> about the querying capability.
> Any help would be Greatly Appreciated !!
> Chris
|||Where do I find query examples using either or both
methods? Thanks!

>--Original Message--
>Depending on the shaping/filtering requirement you can
either use XPath
>against annotated schema or you can use FOR XML on the
relational form (and
>OpenXML or annotated schemas to store and update).
>HTH
>Michael
>"ChrisD" <christopher_douglass@.deletethis.yahooDOTcom>
wrote in message[vbcol=seagreen]
>news:1bce01c5056f$700cc140$a401280a@.phx.gbl...
Server[vbcol=seagreen]
query[vbcol=seagreen]
so
>
>.
>
|||Books Online (the SQL Server documentation) or www.sqlxml.org are two good
places to start.
Best regards
Michael
"Chris Douglass" <anonymous@.discussions.microsoft.com> wrote in message
news:1f4b01c5061f$19d99590$a401280a@.phx.gbl...[vbcol=seagreen]
> Where do I find query examples using either or both
> methods? Thanks!
> either use XPath
> relational form (and
> wrote in message
> Server
> query
> so

How to query an oracle data from SQL server Query analyser

Hi ,

I am having 2 data store .

1. Oracle 10g

2 SQL server 2000

My requirement is that , i need to insert some data from sql server database table to oracle database using sql server query analyser or interface.

If there is any way ,plz let me know it

Thanks

Abraham

You should be able to setup a linkserver in Sql server to Oracle and access Oracle data. Follow this link and this.|||

Hi sankar,

I am trying that option, if that works out how we can insert data or query data from oracle , is that the normal SQL way or some other format is there.

basically i need to write a Sql server trigger on a table which will insert data to oracle based on the new records insertion in sql server.

Thanks

Abraham

|||

I am not sure if that is good idea to wrap this inside a trigger. Though linked servers provide good access to data from different data sources, it comes with some issues. May be you need to be aware of what you getting in to. Check out some these links and read some more.

http://www.thescripts.com/forum/thread80168.html

http://support.microsoft.com/default.aspx?scid=kb;en-us;191168&Product=sql2k

http://support.microsoft.com/kb/306212