Getting error ExecuteReader: CommandText when running comments in query - sql-server

I am getting an error when running a basic query and I cannot understand why.
It seems to be caused when comments are run by themselves.
Below are two query examples. The first gives no error, the second does.
Query 1:
print 'test'
-- test
Result 1:
test
Query 2:
print 'test'
go
-- test
Result 2:
test
An error occurred while executing batch. Error message is: ExecuteReader: CommandText property has not been initialized
My question is, why are comments returning this error and how can I fix this?

I found what causing the problem.
Issue was being caused because I was connected using "Additional Connection Parameters"
Column Encryption Setting = Enabled
This was also causing strange errors like repeated print messages.
When I removed this setting everything went back to normal.

Related

Prevent scripts generating errors in blocks that aren't executed?

if 1=0
begin
print 'This should not run'
select NonexistentField from MyTable
end
else
print 'This should run'
Inside that code I reference a field that depending on the scenario, may or may not exist. The script is meant to be deployed in varied scenarios, and this line is supposed to be avoided by conditional branching in the cases where it's not applicable. This is meant to be simulated by the 1=0 condition meaning the field is absent in this test, so the code using it is not to be executed.
The thing is, even if the select line doesn't execute, provided MyTable exists, the script throws an
invalid column name
error even before running, and the "This should run" message is never shown.
If, on the other hand, MyTable doesn't exist, the code runs fine and the expected "This should run" is shown.
What sense is there to be made from this?
Is there any way to avoid parts of the script that aren't meant to run generating these errors?
As it is, I find myself unable to have a condition indicate whether a field in a table exists, because the code will fail anyway.
Is there any way to avoid parts of the script that aren't meant to run generating these errors?
You need to keep the invalid code from being compiled. So use dynamic SQL.
if 1=0
begin
print 'This should not run'
exec ('select NonexistentField from MyTable')
end
else
print 'This should run'

rsProcessingError - Reporting Services Error - rsErrorReadingNextDataRow

I have ran into a strange issue in one of my SSRS reports. I get the following error:
"An error has occurred during report processing. (rsProcessingAborted)
cannot read the next data row for the dataset Defect_Summary. (rsErrorReadingNextDataRow)"
Whenever I run this dataset's query in query designer, or in management studio, the query runs fine. However, when I run the report in report builder or on the server I get the above error. After researching I have found that the issue has something to do with my parameter.
I have a parameter #PO (Production Order) where the user will provide an 8 digit number i.e. 11002575. In my query I have the following line: OrderNr / 10000 = #PO. In the database, OrderNr is of type bigint and will have a value such as 110025750020. I divide this number by 10000 so that the 8 digit #PO parameter equals the OrderNr such as 11002575.00 = 11002575. I used to use LEFT(OrderNr, 8), but found it slowed down the query so this division has worked better for me.
Anyway, here's the strange part: When I first encountered this error, and after researching, I changed my parameter to type integer (from text). This fixed the problem temporarily and the report ran fine. Then I encountered it again, so I changed the type back to text, and again, it fixed the problem temporarily and the report ran fine. I keep going back and forth with this temporary fix and have not been able to find a permanent resolution to this error, it just keeps coming back after a while of working and then all I know to do is keep going back and forth from integer to text. Can anyone help me resolve this error permanently?

Error in Ingeres E_SC0520_SCS_BAD_DBV SCS_INPUT invalid DBV detected:

Please need help! Issuing this problem for couple days cannot understand and find any useful information on how to resolve it
I am getting this error when I am trying to run procedure with call from php
E_AD2005_BAD_DTLEN ADF routine found DB_DATA_VALUE with an invalid length.
E_SC0520_SCS_BAD_DBV SCS_INPUT invalid DBV detected: db_datatype = -20, db_length = 1, db_prec = 0.
E_SC021C_SCS_INPUT_ERROR SCS_INPUT internal error.
any idea how to resolve it and what does it mean ?
also, strange thing i am getting this error only if I do call from php , if I am calling this procedure from Visual DBA its running perfectly with no errors.
The value of one of your parameters is inconsistent with the declaration in the procedure..
Remember php by default does not define its variables until you put something in it so if you are dealing with a string and it has numeric values php will see that as a numeric variable ..
If in doubt cast your variables (string) $variable_name.

PhpStorm 10 strange database query execution warning

I started using PhpStorm 10 and I faced strange database query behaviour (Sybase IQ), namely I'm getting error:
[010P6] 010P6: A row was received and ignored. java.io.IOException: JZ0EM: End of data.
But query executes and I'm getting relevant result.
010P6 - A row was received and ignored.
Description: An unexpected object of type 0xD1 was encountered in the result set being processed and was ignored. Action: Check the query that generated the result set and correct as required.
Can somebody explain what should I correct? The only guess I have is that it comes long char data in the output.

Coldfusion error executing a sql statement

I keep getting a error that says,
Argument 2 of function Replace cannot be an empty
I can't figure out what I'm doing wrong.
The code:
local.drafts.setSQL( "INSERT messages (tm, draft, linkA, linkB) values (:tm:, :draft:, :linkA:, :linkB:");
local.drafts.addParam(name="tm",value=s,CFSQLTYPE="CF_SQL_TIMESTAMP");
local.drafts.addParam(name="draft",value=1, CFSQLTYPE="CF_SQL_BIT");
local.drafts.addParam(name="linkA",value=h,CFSQLTYPE="CF_SQL_SMALLINT");
local.drafts.addParam(name="linkB",value=b,CFSQLTYPE="CF_SQL_SMALLINT");
local.drafts.execute();
Are you sure the syntax is correct? I don't recall the ending : so would try (keeping note of trailing spaces)
local.drafts.setSQL("INSERT INTO messages (tm, draft, linkA, linkB) VALUES ( :tm , :draft , :linkA , :linkB )");
Might just be that your trailing bracket on the VALUES is on the wrong side of a quote of course
Similar issue was seen in this Error using Query Parameters with cfscript query
If of course this is due to a C+P error please re-post source
This sounds like an issue with Mura's Search Engine Safe (SES) URLs.
This is a replace function error see hasbro's example!
http://webcache.googleusercontent.com/search?q=cache:a0Dxwwp5iPsJ:www.hasbro.com/games/en_US/clue/virtual-mansion/fileSizes.cfm%3Ffn0%3D%26fn1%3Dclue.swf%26&hl=en&gl=us&strip=1

Resources