Showing posts with label output. Show all posts
Showing posts with label output. Show all posts

Thursday, March 8, 2012

[newbie] dbcc showcontig

Hello.

Can you point me to books or good documentation that could help me in
understanding in detail the dbcc showcontig output (and the output of
other command that analize the status of a DB) and permit me
understanding what is going on and taking appropriate action?

Do you think a Microsoft Courses could help in this, or is it necessary
to just study/work to become good in this? If it can be useful, which
Microsoft courses?

Best Regards,
Mamo<mamo74@.gmail.com> wrote in message
news:1106796688.136298.283920@.z14g2000cwz.googlegr oups.com...
> Hello.
> Can you point me to books or good documentation that could help me in
> understanding in detail the dbcc showcontig output (and the output of
> other command that analize the status of a DB) and permit me
> understanding what is going on and taking appropriate action?
> Do you think a Microsoft Courses could help in this, or is it necessary
> to just study/work to become good in this? If it can be useful, which
> Microsoft courses?
> Best Regards,
> Mamo

http://www.sql-server-performance.c..._showcontig.asp

Simon|||This is a good guide but leaves out a huge amount of relevant information
(most significantly a discussion of logical fragmentation, DBCC INDEXDEFRAG
and the effects of multiple files on the DBCC SHOWCONTIG algorithms). You
should also read our whitepaper on the subject (it also deals with when you
should bother to reduce fragmentation).

http://www.microsoft.com/technet/pr...n/ss2kidbp.mspx

Regards

--
Paul Randal
Dev Lead, Microsoft SQL Server Storage Engine

This posting is provided "AS IS" with no warranties, and confers no rights.

"Simon Hayes" <sql@.hayes.ch> wrote in message
news:41f8cfb0_2@.news.bluewin.ch...
> <mamo74@.gmail.com> wrote in message
> news:1106796688.136298.283920@.z14g2000cwz.googlegr oups.com...
> > Hello.
> > Can you point me to books or good documentation that could help me in
> > understanding in detail the dbcc showcontig output (and the output of
> > other command that analize the status of a DB) and permit me
> > understanding what is going on and taking appropriate action?
> > Do you think a Microsoft Courses could help in this, or is it necessary
> > to just study/work to become good in this? If it can be useful, which
> > Microsoft courses?
> > Best Regards,
> > Mamo
> http://www.sql-server-performance.c..._showcontig.asp
> Simon

Friday, February 24, 2012

[HELP] LTM Problem

who can help me with LTM(Local Test Manager), many thanks.
Output as follow-------------------------------
Suite: DefaultSuite StartTime: Mon Oct 13 09:54:51 2003 Version: 02.60.6720.0
-------------------------------
Alias: SQLSv Clsid: SQLOLEDB Version: 08.50.1022.00
Initialization: file=c:\adosql.ini
Context: CLSCTX_INPROC_SERVER
Client: Machine: MINGLEI Processor: Intel System: Windows 2000 Version: 5.0 Build: 2195 Service Pack 4 ThreadingModel: Single

Module: ADO Level 0 Conformance Tests Desc: ADO Provider Tests - Level 0 Version: 01.00.0000.04
TestCase: cn.Close Desc: Connection Close Tests
Variation (1) Open Connection, Close Connection
*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = -2147467259
DESC = Invalid authorization specification
Source = Microsoft OLE DB Provider for SQL Server

*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Connection

*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = -2147467259
DESC = Invalid authorization specification
Source = Microsoft OLE DB Provider for SQL Server

*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Connection

FAILED
Variation (2) Close Connection before opening
PASSED
TestCase: cn.Execute Desc: Connection Execute Tests
Variation (1) Execute valid command string
*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = -2147467259
DESC = Invalid authorization specification
Source = Microsoft OLE DB Provider for SQL Server

*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Connection

*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Recordset

*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Connection

FAILED
Variation (2) Execute zero length string
*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = -2147467259
DESC = Invalid authorization specification
Source = Microsoft OLE DB Provider for SQL Server

*** FAILED ***

EXPECTED ERROR = -2147217908
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Connection

*** FAILED ***

EXPECTED ERROR = -2147217908
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Connection

FAILED
TestCase: cn.Open Desc: Connection Open Tests
Variation (1) Open connection, check for property count increase
*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = -2147467259
DESC = Invalid authorization specification
Source = Microsoft OLE DB Provider for SQL Server

Property count did not increase after open
*** FAILED ***

NO ERROR EXPECTED
ACTUAL ERROR = 3704
DESC = Operation is not allowed when the object is closed.
Source = ADODB.Connection

FAILED
Summary: Failures: 4 Warnings: 0 Skipped: 0 Passed: 1 Run: 5 Percent: 20
-------------------------------
SuiteEnd: DefaultSuite Status: Complete StopTime: Mon Oct 13 09:54:51 2003
Fail Warn Skip Pass Percent Alias Module
4 0 0 1/ 5 20% SQLSv ADO Level 0 Conformance Tests
-------------------------------Invalid authorization specification
Sounds like an error in the connection string.
Maybe the string is invalid or maybe the server isn't set up to allow sql server authyentication and it is using that.|||thanks, but every settings is by default, what can I do then ?

Sunday, February 19, 2012

[DTS.Pipeline] Warning: The output column "Column 5" (1038) on output "Flat File

[DTS.Pipeline] Warning: The output column "Column 5" (1038) on output "Flat File Source Output" (2) and component "Flat File Source" (1) is not subsequently used in the Data Flow task. Removing this unused output column can increase Data Flow task performance.

what the heck does this mean?

More or less what it says - you have a column that is not used by downstream component.

So the data flow issues a warning that it might be better to just remove this column to save buffer space. Of course it is just optimization warning and can be ignored, but if you want maximum performance do pay attention to such warnings.

Thursday, February 9, 2012

@@RowCount output param

The following stored procedure sets a value for the @.@.RowCount global variable.

How do I make use of it in the Data Access Layer?

When I set the SPROC as the source for the object, the value numberRows does not appear to be an option. In the end I just want to set the value of @.@.RowCount to a Label.Text

What should I do?

ALTER PROCEDURE dbo.ap_Select_ModelRequests_RequestDateTime@.selectDatedatetime ,@.selectCountryInt ASSELECT DISTINCT confignameFROM ModelRequestsJOIN CC_host.dbo.usr_cmcAs t2ON t2.user_id = ModelRequests.usernameJOIN CountriesONCountries.Country_Short = t2.countryWHERE RequestDateTime >= @.selectDateand RequestDateTime <dateadd(dd,1, @.selectDate)AND configname <>''AND interfacenameLIKE'%DOWNLOAD%'AND result = 0AND Country_ID = @.selectCountryORDER BY confignameSELECT@.@.RowCountAs numberRowsGO

try this:

declare @.MyRowCounter int
select @.MyRowCounter = @.@.RowCount as numberRows

|||

This will work as written, but what you get back is an answer set with 1 row and 1 column, you would use a datareader to read it.

A perhaps better -- or at least clearer -- way is to store the number in an output variable. Then, when you set up the call to execute the proc you declare the parameter direction as OUTPUT (this link has an example --http://www.msdner.com/forum/thread445973.html)

ALTER PROCEDURE dbo.ap_Select_ModelRequests_RequestDateTime
@.selectDatedatetime
,@.selectCountryInt

,@.numberRows int OUTPUT
AS

SELECT DISTINCT confignameFROM ModelRequestsJOIN
CC_host.dbo.usr_cmcAs t2ON
t2.user_id = ModelRequests.usernameJOIN
CountriesON
Countries.Country_Short = t2.country
WHERE RequestDateTime >= @.selectDateand RequestDateTime <dateadd(dd,1, @.selectDate)
AND configname <>''AND interfacenameLIKE'%DOWNLOAD%'AND result = 0AND Country_ID = @.selectCountry
ORDER BY configname
SELECT @.numberRows=@.@.rowcount

@@Rowcount or output parameters error

I have the following stored procedure working with an Access 2000 front end. The output parameters returned to Access are both Null when the record is successfully updated (ie when @.@.Rowcount = 1), but the correct parameters are returned when the update fails. I'm a bit new to using output parameters, but I have them working perfectly with an insert sproc, and they look basically the same. What bonehead error have I made here? The fact that the record is updated indicates to me that the Commit Trans line is being executed, so why aren't the 2 output parameters set?

TIA

EDIT: Solved, sort of. I found that dropping the "@.ResNum +" from "@.ResNum + ' Updated'" resolved the problem (@.ResNum is an input parameter). This implies that the variable lost its value between the SQL statement and the If/Then, since the SQL correctly updates only the appropriate record from the WHERE clause. Is this supposed to happen? I looked in BOL, and if it's addressed there I missed it.

CREATE PROCEDURE [procResUpdate]

Various input parameters here,

@.RetCode as int Output, @.RetResNum as nvarchar(15) Output

AS

Declare @.RowCounter int

Begin Tran

UPDATE tblReservations
SET Various set statements here, LastModified = @.LastModified + 1
WHERE ResNum = @.ResNum AND LastModified = @.LastModified

SELECT @.RowCounter = @.@.ROWCOUNT

If @.RowCounter = 1
Begin
Commit Tran
Select @.RetCode = 1
Select @.RetResNum = @.ResNum + ' Updated'
End
Else
Begin
Rollback Tran
Select @.RetCode = 0
Select @.RetResNum = 'Update Failed'
End
GOPost the complete DDL for the proc (including @.ResNum) and a sample of calling it that produces the problem you describe.

Regards,

hmscott|||Here's the complete sproc (I added back the offending part in red):

CREATE PROCEDURE [procResUpdate]

@.ReqDate as datetime, @.PassName as nvarchar(25), @.DispDate as datetime, @.PassPhone as nvarchar(25),
@.PassQuant as smallint, @.AuthBy as nvarchar(25), @.AcctID as smallint, @.PuLandmark as smallint, @.PuStreet as nvarchar(50),
@.PuCity as smallint, @.PuXStreet as nvarchar(50), @.PuPoint as nvarchar(50), @.DestLandmark as smallint, @.DestStreet as nvarchar(50),
@.DestCity as smallint, @.DestXStreet as nvarchar(50), @.DestPoint as nvarchar(50), @.Operator as smallint, @.Comments as nvarchar(250),
@.DriverReq as nvarchar(25), @.CarType as smallint, @.EstHours as money, @.EstPrice as money, @.CCType as nvarchar(25), @.CCnum as nvarchar(25),
@.CCAuthNum as nvarchar(25), @.CarQuant as tinyint, @.ResNum as int, @.Status as smallint, @.LastModified as tinyint,

@.RetCode as int = Null Output, @.RetResNum as nvarchar(15) = Null Output

AS

Declare @.RowCounter int

Begin Tran

UPDATE tblReservations
SET ReqDateTime = @.ReqDate, PassName = @.PassName, DispDateTime = @.DispDate, PassPhone = @.PassPhone, PassQuant = @.PassQuant, AuthBy = @.AuthBy, AcctID = @.AcctID,
PuLandmarkID = @.PuLandmark, PuStreet = @.PuStreet, PuCityID = @.PuCity, PuXStreet = @.PuXStreet, PuPoint = @.PuPoint, DestLandmarkID = @.DestLandmark, DestStreet = @.DestStreet,
DestCityID = @.DestCity, DestXStreet = @.DestXStreet, DestPoint = @.DestPoint, OperatorID = @.Operator, Comments = @.Comments, DriverReq = @.DriverReq, CarType = @.CarType,
EstHours = @.EstHours, EstPrice = @.EstPrice, CCType = @.CCType, CCNum = @.CCnum, CCAuthNum = @.CCAuthNum, CarQuant = @.CarQuant, Status = @.Status, LastModified = @.LastModified + 1
WHERE ResNum = @.ResNum AND LastModified = @.LastModified

SELECT @.RowCounter = @.@.ROWCOUNT

If @.RowCounter = 1
Begin
Commit Tran
Select @.RetCode = 1
Select @.RetResNum = ' Updated'
End
Else
Begin
Rollback Tran
Select @.RetCode = 0
Select @.RetResNum = @.ResNum + ' Update Failed'
End
GO


and the VBA that calls it. The 2 highlighted lines will be null if the "@.ResNum + " is included. Otherwise, it runs fine.

Public Sub cmdUpdate_Click()
Dim strSQL As String
Dim strField As String
Dim fOK As Integer
Dim intCount As Integer
Dim x As Integer
Dim strMsg As String
Dim cmd As ADODB.Command
Dim db As DAO.Database
Dim rs As DAO.Recordset
Dim tdf As DAO.TableDef
Dim dteReqDate As Date
Dim dteDispDate As Date

On Error GoTo ErrorHandler

dteReqDate = Me.txtReqDate & " " & Me.txtReqTime
dteDispDate = DateAdd("n", -Nz(Me.txtMinutesAhead, 0), dteReqDate)

Call EstablishConnection
Set db = CurrentDb()
Set cmd = New ADODB.Command
Set rst = New ADODB.Recordset
Set tdf = db.TableDefs("tblReservations_Local")
rst.ActiveConnection = objConn

With cmd
.ActiveConnection = objConn
.CommandText = "procResUpdate"
.CommandType = adCmdStoredProc

.Parameters.Append .CreateParameter("@.ReqDate", adDBTimeStamp, adParamInput, , dteReqDate)
.Parameters.Append .CreateParameter("@.PassName", adVarChar, adParamInput, 25, Me.txtPassName)
.Parameters.Append .CreateParameter("@.DispDate", adDBTimeStamp, adParamInput, , dteDispDate)
.Parameters.Append .CreateParameter("@.PassPhone", adVarChar, adParamInput, 25, Me.txtPassPhone)
.Parameters.Append .CreateParameter("@.PassQuant", adInteger, adParamInput, , Me.txtPassQuant)
.Parameters.Append .CreateParameter("@.AuthBy", adVarChar, adParamInput, 25, Me.txtAuthBy)
.Parameters.Append .CreateParameter("@.AcctID", adInteger, adParamInput, , Me.cboAcctNum)
.Parameters.Append .CreateParameter("@.PuLandmark", adInteger, adParamInput, , Me.cboLandmark)
.Parameters.Append .CreateParameter("@.PuStreet", adVarChar, adParamInput, 50, Me.txtPuAddress)
.Parameters.Append .CreateParameter("@.PuCity", adInteger, adParamInput, , Me.cboPuCity)
.Parameters.Append .CreateParameter("@.PuXStreet", adVarChar, adParamInput, 50, Me.txtPuXStreet)
.Parameters.Append .CreateParameter("@.PuPoint", adVarChar, adParamInput, 50, Me.txtPuPoint)
.Parameters.Append .CreateParameter("@.DestLandmark", adInteger, adParamInput, , Me.cboDestLandmark)
.Parameters.Append .CreateParameter("@.DestStreet", adVarChar, adParamInput, 50, Me.txtDestAddress)
.Parameters.Append .CreateParameter("@.DestCity", adInteger, adParamInput, , Me.cboDestCity)
.Parameters.Append .CreateParameter("@.DestXStreet", adVarChar, adParamInput, 50, Me.txtDestXStreet)
.Parameters.Append .CreateParameter("@.DestPoint", adVarChar, adParamInput, 50, Me.txtDestPoint)
.Parameters.Append .CreateParameter("@.Operator", adInteger, adParamInput, , Me.txtOperator)
.Parameters.Append .CreateParameter("@.Comments", adVarChar, adParamInput, 250, Me.txtComments)
.Parameters.Append .CreateParameter("@.DriverReq", adVarChar, adParamInput, 25, Me.txtDriverReq)
.Parameters.Append .CreateParameter("@.CarType", adInteger, adParamInput, , Me.cboCarType)
.Parameters.Append .CreateParameter("@.EstHours", adCurrency, adParamInput, , Me.txtEstHours)
.Parameters.Append .CreateParameter("@.EstPrice", adCurrency, adParamInput, , Me.txtEstPrice)
.Parameters.Append .CreateParameter("@.CCType", adVarChar, adParamInput, 25, Me.cboCCType)
.Parameters.Append .CreateParameter("@.CCnum", adVarChar, adParamInput, 25, Me.txtCCNum)
.Parameters.Append .CreateParameter("@.CCAuthNum", adVarChar, adParamInput, 25, Me.txtCCAuthNum)
.Parameters.Append .CreateParameter("@.CarQuant", adInteger, adParamInput, , Me.txtCarQuant)
.Parameters.Append .CreateParameter("@.ResNum", adInteger, adParamInput, , Me.txtResNum)
.Parameters.Append .CreateParameter("@.Status", adInteger, adParamInput, , Me.cboStatus)
.Parameters.Append .CreateParameter("@.LastModified", adInteger, adParamInput, , Me.txtLastModified)

.Parameters.Append .CreateParameter("@.RetCode", adInteger, adParamOutput)
.Parameters.Append .CreateParameter("@.RetResNum", adVarChar, adParamOutput, 15)

.Execute

End With

fOK = cmd.Parameters("@.RetCode")
strMsg = cmd.Parameters("@.RetResNum")|||Update for anyone interested. It seems that there was a type mismatch occurring. @.ResNum is a numeric value (data type int), and apparently in this line that caused a problem:

Select @.RetResNum = @.ResNum + ' Update Failed'

I assumed it would concatenate the two values. If I create a new varchar variable and populate it with the value of @.ResNum (converted to varchar) and use that, everything works fine. What threw me was that not only was that return parameter null, but the other one was too.