Showing posts with label online. Show all posts
Showing posts with label online. Show all posts

Monday, March 26, 2012

How to connect to Remote SQL Server database using SQL Server 2005 Express

Hi,

I've an account with a hosting service provider online for SQL Server database. I've downloaded SQL Server 2005 Express from ASP.Net. How can I use it to connect to my SQL Server Database which is sitting on remote server? The hosting provider gave me following things to connect to the remote database.

Server Name
Database Name
User Name
Password

Regards,
A.K.R

Anyone?

|||I don't want to ask the obvious, but is there not a Read Me fileincluded with the download of SQL Express which would explain how toconnect?

Sorry I can't be more helpful, but I've only ever briefly looked at SQLExpress and decided to stick to MSDE since I could not see any benefitof using Express when MSDE is a cheap but far more powerful option thanSQL Express.

Wednesday, March 21, 2012

How to configure the server notification in SQL 2005.

I couldn't find anything in the book online or tutorial addressing
this question.
Does anyone know how and what version of Outlook should be used?
Thank you!Why do you need Outlook? If you use the new Database Mail feature, all you
need is an SMTP server willing to relay...
"=== Steve L ===" <steve.lin@.powells.com> wrote in message
news:1134163048.351008.299170@.f14g2000cwb.googlegroups.com...
> I couldn't find anything in the book online or tutorial addressing
> this question.
> Does anyone know how and what version of Outlook should be used?
> Thank you!
>|||hey thanks. that's nice to know and it worked.
how about 'operators'? in sql 2000 EM you can test the operators under
the property page, but that option is no long available in sql 2005.
any idea?
thank you|||> how about 'operators'? in sql 2000 EM you can test the operators under
> the property page, but that option is no long available in sql 2005.
> any idea?
Never used them, probably never will. What do you plan on using them for?|||depends on the type of the scheduled jobs, the notification can go to
different users or emailing groups, or a pager. it's nice to be able to
test the validity of the operators before they go into production.|||> depends on the type of the scheduled jobs, the notification can go to
> different users or emailing groups, or a pager.
With database mail, you can go to an e-mail address, or a distribution list,
or the e-mail address of the pager. Still not sure why you need an
"operator"...
A|||I don't know how to explain it more clear than I alredy did. pls take a
look of
How to: Notify an Operator of Job Status for details in BOL. hope that
helps.
I do appreciate your response; however, I believe my question was about
how to 'test' a operator like in sql 2000 EM, not about why one should
use it, or what the 'operator' is for. If you've never used it and
never will (as you said), pls don't let my question burnden you for an
answer. Thank you.|||How about having a test job which just sends an email that you run on demand
?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"=== Steve L ===" <steve.lin@.powells.com> wrote in message
news:1134169235.025163.56700@.o13g2000cwo.googlegroups.com...
> depends on the type of the scheduled jobs, the notification can go to
> different users or emailing groups, or a pager. it's nice to be able to
> test the validity of the operators before they go into production.
>

Sunday, February 19, 2012

how to clean all messages of a queue ?

How to clean all messages of a queue ?

Online books says it can be done as below:
RECEIVE * FROM ExpenseQueue

But it only delete a row every time,and I found all the three statement only delete a row:

RECEIVE * FROM ExpenseQueue
RECEIVE TOP(1) * FROM ExpenseQueue
RECEIVE TOP(n) * FROM ExpenseQueue

The RECEIVE statement (as it exists today) only fetches messages belonging to a single conversation group at a time. So the only way to get rid of all messages is to call RECEIVE in a loop:

WHILE (1)
BEGIN
RECEIVE * FROM ExpenseQueue
IF (@.@.ROWCOUNT = 0)
BREAK
END

Are you just looking at means to clean up the queue, or do you really want to fetch multiple conversation groups in a single batch. If it is the latter, could you explain your requirements further to help us improve the product in future versions?

Thanks,
Rushi
--
Developer, Service Broker Team, SQL Server Engine
Microsoft Corporation

|||Rushi's answer assumes that you indeed just want to get rid of the messages and leave the conversations active. If you also want to clean up the conversations - say you have run a bunch of tests and found your application doesn't work correctly - you might want to try one of these scripts which work in ascending dgrees of severity. If you truely don't care at all about the messages or conversations, try the last one:

-- End conversations that are in an error state

declare @.handle uniqueidentifier

declare conv cursor for select conversation_handle from sys.conversation_endpoints where state = 'ER'

open conv

fetch NEXT FROM conv into @.handle

while @.@.FETCH_STATUS = 0

Begin

END Conversation @.handle with cleanup

fetch NEXT FROM conv into @.handle

End

close conv

deallocate conv

-- End conversations that are half closed

declare @.handle uniqueidentifier

declare conv cursor for select conversation_handle from sys.conversation_endpoints where state = 'DI'

open conv

fetch NEXT FROM conv into @.handle

while @.@.FETCH_STATUS = 0

Begin

END Conversation @.handle with cleanup

fetch NEXT FROM conv into @.handle

End

close conv

deallocate conv

-- End all conversations

declare @.handle uniqueidentifier

declare conv cursor for select conversation_handle from sys.conversation_endpoints

open conv

fetch NEXT FROM conv into @.handle

while @.@.FETCH_STATUS = 0

Begin

END Conversation @.handle with cleanup

fetch NEXT FROM conv into @.handle

End

close conv

deallocate conv

|||scripts of Roger_MS can solve my problem, but seems it clean all messages of all queues. If I want to clean a queue only, should I use my Queue_Name to replace sys.conversation_endpoints ? Just as

declare conv cursor for select conversation_handle from Queue_Name

And I think it is convenient to use a statement like "alter queue XXX with cleanup" .

Thank you.|||That would clean up one end of the conversations in the queue. Keep in mind that conversations always involve 2 queues so if you want to clean up the conversations you will have to clean up both queues. This is definitely not something you want to do regularly. Clearing out a queue is equivalent to truncating a table - there will often be valuable data destroyed if you do this so this would generally be something you do only during development.