Friday, March 23, 2012
out parameter
i am trying to get a returned value from a SP using an out parameter.
my code is in C# and i need some help (pls).
be greatfull if you send an example of the SP and the C# code that execute
it and collect the returning parameter value.
thanks a lot, Ran.
I don't think this has a C# example but it does explain OutPut parameters:
http://www.support.microsoft.com/?id=262499
Andrew J. Kelly SQL MVP
"Ran Y" <ranyc@.012.net.il> wrote in message
news:OjMSGU$PEHA.3456@.TK2MSFTNGP11.phx.gbl...
> hello all,
> i am trying to get a returned value from a SP using an out parameter.
> my code is in C# and i need some help (pls).
> be greatfull if you send an example of the SP and the C# code that execute
> it and collect the returning parameter value.
> thanks a lot, Ran.
>
|||[posted and mailed, please reply in news]
Ran Y (ranyc@.012.net.il) writes:
> i am trying to get a returned value from a SP using an out parameter.
> my code is in C# and i need some help (pls).
> be greatfull if you send an example of the SP and the C# code that execute
> it and collect the returning parameter value.
You did not specify which .Net Data Provider you are using, so I am
assuming SqlClient. Furthermore, the code I have around is VB.Net,
so you will need to transliterate in to C# on your own:
Dim p As SqlParameter = New SqlParameter
p.ParameterName = "@.outparam"
p.DbType = SqlDbType.Int ' For instance.
p.Direction = ParameterDirection.InputOutput
p.Value = DBNull.Value
cmd.Parameters.Add(p)
cmd.ExecuteNonQuery ' Or .Fill or an .ExecuteReader loop
The value of @.outparam is now in p.Value.
There are a couple of variations on how you can create the
parameter, see the online documentation for this.
Erland Sommarskog, SQL Server MVP, sommar@.algonet.se
Books Online for SQL Server SP3 at
http://www.microsoft.com/sql/techinf...2000/books.asp
Wednesday, March 21, 2012
Out of memory while querying causes wrong data to be returned
Running AS 2000, SP4.
A couple of times while querying a cube, one member has got the wrong data displayad (the value are to low).
No matter if I reload the query afterwards, restarting the query application etc, the same faulty value still gets displayed for that member.
After I restart analysis services the value is correct again. No other changes, exact the same query etc.
While analysing the event viewer I see that analysises services has run out of memory before this strange behaviour (MSSQLServerOLAPService - "The server is out of memory").
Could this out-of-memory error has caused the wrong value to be returned, and the somehow the value has got cached on the analysis server so it's not fixed until the server has restarted?
This is the only theory I have, and it's important to figure out the cause. Users are getting worried if they can't trust the data.
The server is dedicated to analysis services and has 3GB memory and /3GB switch enabled. Memory conservation treshold is 2700mb and Minimum allocated memory is set to 1536mb.
The query tool is an asp-application using ADOMD, but the same faulty value was returned while trying the query in MDX Sample App.
First of all try installing SP4 http://www.microsoft.com/downloads/details.aspx?displaylang=en&FamilyID=8E2DFC8D-C20E-4446-99A9-B7F0213F8BC5
Second, if problem persists contact customer support and have them looking into your problem.
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
There isn't much to recommed in this case.
Have your problem looked at by the customer support ( the doctors) :)
HTH
Edward.
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Saturday, February 25, 2012
osql -b question!
"osql -b will specifies that OSQL exits and returns a DOS ERRORLEVEL value when an error occurs. The value returned to the DOS ERRORLEVEL variable is 1 when the SQL Server error message has a severity of 10 or greater; otherwise, the value returned is 0."
my question is : how can I get the DOS ERRORLEVEL.
example:
C:\>isql -E -b -Q"backup log pubs to disk='C:\adsfasd.tmp'"
the result:
Msg 4208, Level 16, State 0, Server YANG, Line 1
当恢复模型为 SIMPLE 时,不允许使用 BACKUP LOG 语句。请使用 BACKUP DATABASE 或用
ALTER DATABASE
更改恢复模型。
Msg 3013, Level 16, State 1, Server YANG, Line 1
BACKUP LOG 操作异常终止。
It's in chinese language,means
"can not use BACKUP LOG when the restore model being SIMPLE,you can use ALTER DATABASE or BACKUP DATABASE to change the restore model.
Msg 3013, Level 16, State 1, Server YANG, Line 1
BACKUP LOG aborted"
where is DOS ERRORLEVEL?? How can I get it??
thankstake a look at the server errorlog or the backupserver errorlog for details|||See KB#39585 (http://support.microsoft.com/default.aspx?scid=kb;en-us;39585).
-PatP