|
I have tried to approach this from all angles except the working ones. Please help me if you have any idea what I'm doing wrong.
* I have a database, let's say "myDB"
* In myDB I have a stored procedure called myDB..procStartJob
* When I created this procedure I was logged in as the sysadmin (sa)
* I created this sp and used the "With Execute As OWNER" clause
This procStartJob has code inside it which executes msdb.dbo.sp_start_job
My problem is that whenever I execute myDB..procStartJob I get the following message:
EXECUTE permission denied on object 'sp_start_job'
But I specified that the procedure should "EXECUTE AS OWNER" which according to me is the sysadmin. In books online sp_start_job's documentation specifies that members of the sysadmin fixed server role can execute this sp. So why can't I?
Thank you in advance!
_______________________________________________________________________
http://www.readytogiveup.com/[ ^]
"you can't forget something you never knew..." M. Du Toit
|
|
|
|
|
The problem is that after reducing MSDTC security to "No Authentication", it mostly seems to work correctly, except that after a brief period of inactivity (a few minutes), the first attempt to use DTC fails, but subsequent attempts are successful, until inactivity again.
The original environment was a single machine with SQL Server installed and a service on another machine that would connect to the same SQL Server but utilizing different connections concurrently within the same transaction (using TransactionScope). This configuration worked fine.
The single machine with SQL Server installed has been changed to a cluster of two machines. Otherwise the configuration is the same. The "Distributed Transaction Coordinator" service is running as the Network Service account in all cases. Now the following error is generated when the second connection is made in the transaction (presumably promoting the transaction to DTC):
System.Transactions.TransactionManagerCommunicationException
Communication with the underlying transaction manager has failed.
All of these machines are running Win2003 SP1. I've also tried using my local machine (which is XP Pro SP2) as the service machine with the same results. The current solution is to modify the MSDTC tab in Component Services from "Mutual Authentication Required" to "No Authentication Required". This isn't an ideal solution, but seems to work...somewhat. After about 15 minutes of inactivity, the first attempt to connect to SQL Server in the transaction generates the same error as above. Also, the following entry now appears about 5 times in a row in the Security event log. Any subsequent connections seem to work fine until another period of inactivity.
Logon Failure:
Reason: Unknown user name or bad password
User Name: SQLMACHINE$
Domain: MYDOMAIN
Logon Type: 3
Logon Process: NtLmSsp
Authentication Package: NTLM
Workstation Name: SQLMACHINE
Caller User Name: -
Caller Domain: -
Caller Logon ID: -
Caller Process ID: -
Transited Services: -
Source Network Address: xxx.xxx.xxx.xxx
Source Port: 1623
A Google search yielded few results about NtLmSsp and the error. One solution I've found to prevent the initial failure is to run ipconfig /flushdns prior to the first call and that seems to prevent it. However, after the 15 minute period of inactivity, it seems to start again.
I've also tried the recommendations from the following links with no success.
http://blogs.msdn.com/florinlazar/archive/2004/06/18/159127.aspx
http://blogs.msdn.com/florinlazar/archive/2004/03/02/82916.aspx
http://technet.microsoft.com/en-us/library/bb457156.aspx#EGAA
The ideal solution would be to use the "Incoming Caller Authentication Required" or stronger and to prevent the initial connection failure. Any suggestions on the cause of this or what might be done to fix it?
Thanks
|
|
|
|
|
how to retrieve the last 4 or 5 records from a database table, i want to retrive the latest recirds which are entered not all or old records
|
|
|
|
|
If you have some way of determining the time (or sequence) the rows were inserted in the table (e.g. a date stamp column, of an incremental sequence number or id) then this is quite easy.
SELECT TOP 5 * FROM MyTable ORDER BY TimeStamp DESC
Upcoming events:
* Glasgow: Mock Objects, SQL Server CLR Integration, Reporting Services, db4o, Dependency Injection with Spring ...
"I wouldn't say boo to a goose. I'm not a coward, I just realise that it would be largely pointless."
My website
|
|
|
|
|
hi,
is there any query to check whether a database exits or not ?
thank ..
|
|
|
|
|
|
I think based on some of his other questions in the past, he might be doing homework. Why bother doing your own work?
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
uh huh.
Unless someone seems to have done a decent amount of investigation and research and is stuck on a specific problem I'll always put in the same amount of effort they've put into asking the question and just post a google link.
|
|
|
|
|
Any specific guidelines when we should go for return/output wrt SQL Server stored procedures.
If i have only one output to return?
Thanks,
Amit
|
|
|
|
|
Does your app need to work with the returned value?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
|
Ummm, does your app do anything with the returned value? E.g. report the row count, put the returned values in a datagrid, etc?
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I tend to reserve the return value for succeeded/failed notifications, where I haven't used RAISERROR (which throws a SqlException in .NET client code). The return value can only be an integer, while output parameters can be any type.
I rarely use output parameters unless it's an out-of-band value, not associated with the other data in a result set, and I don't want to return an extra result set just containing that data.
|
|
|
|
|
Hi,
In my form I have so many textboxes and check boxes and Gridview, When the user clicks on a button I need to insert those data into different tables in Oracle database.
Can anyone tell me the best way to do the multiple inserts in to different tables in Oracle database.
Thanks in advance
|
|
|
|
|
I haven't worked with Oracle in a few years, so bear with me. You could try doing the inserts through a stored procedure.
"Any sort of work in VB6 is bound to provide several WTF moments." - Christian Graus
|
|
|
|
|
I believe Oracle supports multiple statements in one batch. Ultimately you will have to write one insert statement per table, whether you do that as multiple statements in one batch or in a stored procedure.
SQL Server allows you to update a view if you supply an INSTEAD OF trigger which redirects the updates to the appropriate base tables. I don't know whether Oracle has a similar feature.
|
|
|
|
|
Hello ,
I want to wirte a sql statment which converts varchar into date (mm/dd/yyyy) format. please help
thanks
|
|
|
|
|
CAST( @var AS datetime ) works well for dates in the current DATEFORMAT or using ISO 8601 format (yyyyMMdd). The DATEFORMAT defaults to the appropriate format for the current LANGUAGE (really a locale). The default value for LANGUAGE comes from the user's login, which in turn gets it (at creation time) from the server's default language option.
Otherwise look at CONVERT .
As a best practice you should pass dates and indeed all other user-supplied data using parameterized queries, for which see the documentation for the provider you're using. That passes the data using a well-understood datatype, rather than parsing the information multiple times.
|
|
|
|
|
Friends,
Can somebody tell me how to find number of rows returned by EXEC statement?
I have following example.
SET @Sql = 'SELECT COUNT(*) FROM Table where columnA = 10'
EXEC (@Sql).
Where can I get count?
Jayant
|
|
|
|
|
Hi Jayant
You would only the "EXEC" if your SQL statement is dynamic. The following code would allow you to get the count for your above static SQL:
DECLARE @Rows INT
SELECT @Rows = COUNT(*) FROM Table where ColumnA = 10 If you want to search for different values then use:
DECLARE @Rows INT, @MySearch INT
SET @MySearch = 9
SELECT @Rows = COUNT(*) FROM Table where ColumnA = @MySearch If your SQL truely needs to be dynamic then use:
DECLARE @Rows INT, @SQL VARCHAR(500)
--Create temporary table to hold results.
CREATE TABLE #temp_result (Rows INT NOT NULL)
--Construct and execute dynamic SQL to be used (would normally be more complex).
SET @SQL = 'INSERT INTO #temp_result (Rows)
SELECT COUNT(*) FROM Table where columnA < 10'
EXEC (@SQL)
--Get results.
SELECT @Rows = Rows FROM #temp_result Hope that helps.
Andy
If you want to thank me for my help, please vote my message by clicking one of numbers beside "Rate this message".
|
|
|
|
|
Hey Andy,
Thanks a lot for gr8 answer..
It worked well.
I voted 5...
Jayant
|
|
|
|
|
hello sir
I am trying to execute a querry which i get through Visual Studio and getting the AM/PM in Korean One but it give some error "cant not convertion failed when convert datetime from charectestring".i get the following querry.
update WS_STOKHDRTICKET set SELLSTART= '2007-07-09',
SELLEND='2007-07-25',VALIDITYEXPIRY= convert(datetime,'2007-07-23 오전12:00:00',120) ,
MAXIMUMQTY=1,WEBDESCRIPTION='ss',TERMSCONDITIONS='',VALIDITYOPTION=0,
VALIDITYPERIOD=1,CONCESSIONWARNING=0,CONCESSIONWARNINGTEXT='',WEBPRICINGMETHOD=2,TICKETTYPE=5 ,SHOWANYDAYTICKET =1,SHOWPREBOOKEDVISIT =1 ,QTYINCLUDEINTICKETCOUNT =12 where STOKHDRUCODE=8
if there is any way to solve the problem then please help me
Thanks Regards
Biplab Kumar Saha
|
|
|
|
|
Biplab saha wrote: convert(datetime,'2007-07-23 오전12:00:00',120)
The 120 in the 3rd parameter of the convert specifies that the string will be ODBC Canonical format (yyyy-mm-dd hh:mm:ss) where the time is 24hr clock time, but the string you are passing it (2007-07-23 오전12:00:00) contains extra, unexpected characters in the middle. You need to remove those characters and convert the time to 24hr time if necessary.
|
|
|
|
|
Hi!
I have a problem.
I don't know how to attach properly my menu web control to my database.
No. Don't laugh, please...
It's a bigger issue than you think, just read on.
You see, the menuitems are changing often and per permission level. This means that the menuitems must be stored in an XML file and cached. Each time there's an update, its recached.
I am using a typed dataset (myMenuItems.xsd) from wizard with the table adapter
<br />
private MenuItemsTableAdapters.MenuItemsTableAdapter myMITA = <br />
new test.MenuItemsTableAdapters.MenuItemsTableAdapter();<br />
<br />
private test.myMenuItems.MenuItemsDataTable myMI;<br />
<br />
private DataSet myDS = new DataSet();<br />
<br />
private XmlDataDocument myTemp;<br />
<br />
[...].br />
<br />
protected void Page_Load(object sender, EventArgs e)<br />
{<br />
if (!Page.IsCallback)<br />
{<br />
myMI = myMITA.GetData();<br />
myTemp = new XmlDataDocument();<br />
[...].br />
<br />
The humble question I ask is where do I go from there? I mean, how do I stuff the XML document with the menuitems, and how do I then stuff it into the cache and into the menu control?
My boss laid a project on me that is slightly above my technical competence for the moment. I would appreciate any help.
Thank you,
Antoine Dubuc
Transcontinental
|
|
|
|
|
If they change often and per permission level (do you mean per user?), then the cache is probably not the right place for these.
|
|
|
|