Operand type clash: nvarchar(max) is incompatible with nvarchar(max) - sql-server-2016

Hi I am getting a following error any idea how can i solve this
Operand type clash: nvarchar(max) is incompatible with nvarchar(max)
encrypted with (encryption_type = 'DETERMINISTIC',
encryption_algorithm_name = 'AEAD_AES_256_CBC_HMAC_SHA_256',
column_encryption_key_name = 'TEST',
column_encryption_key_database_name = 'dev')

Related

Vpython Error: 'float' object has no attribute '_x'

I am writing a Vpython simulation for projectile motion and keep getting the error ('float' object has no attribute '_x') on this line(ball.vel.y = ball.vel.y + g*dt) . I have tried changing the values of ball.vel.y to an integer and changing g to an integer but the same error occurs. Here is the code
from vpython import *
import math
ball=sphere(radius=0.1, color=color.red, pos=vector(0.1,0.1,0),make_trail=True)
floor=box(pos=vector(0,0,0), length=10, height=0.01, width=0.01)
g= vector(0,-9.8 ,0)
ball.vel=vector(10*cos(43),10*sin(43),0)
dt=0.1
t=0.0
while(ball.pos.y>-0.001):
rate(100)
t=t+dt
ball.pos.x = ball.pos.x + ball.vel.x*dt
ball.vel.y = ball.vel.y + g*dt
ball.pos.y = ball.pos.y + ball.vel.y*dt
g is a vector, as is g*dt, but ball.vel.y is a scalar, and you can't add a vector to a scalar. It's unfortunate that the error message doesn't just say "You can't add a vector to a scalar". I note that if you reverse the two quantities the error message is a bit more understandable: TypeError: unsupported operand type(s) for +: 'vpython.cyvector.vector' and 'float'

Replace with loc raises invalid type comparison

Replace with loc raises type error invalid type comparison. In excel both column are text. What is the mistake here?
d= {'col1': ['Very High', 'High'], 'col2': ['High', 'Very High]}
LL = pd.DataFrame(data=d)
LL.loc[LL['col1'] == 'Very High', 'col1'] = 4 #Error
LL.loc[LL['col2'] == 'Very High', 'col2'] = 4 #No error
col1 object
col2 object
C:\Program Files (x86)\Anaconda3\lib\site-packages\pandas\core\ops.py:1164: FutureWarning: elementwise comparison failed; returning scalar instead, but in the future will perform elementwise comparison
result = method(y)
TypeError: invalid type comparison

SQL R Code The tutorial problem , Predict From Model wont run. Unserialize Error

I ve created a model In R server , the tutorial example on the microsoft site. I have read simila texts /problems and the resolution was to wrap the model in as.raw befpore unserialize ..this does not help!!.
Note I am new to this and have not seen a resolution. I refer to the script on the page
"Quickstart: Predict from model using R in SQL Server" on the Microsoft site ie
DECLARE #glmmodel varbinary(max) =
(SELECT model FROM dbo.GLM_models WHERE model_name = 'default model');
EXEC sp_execute_external_script
#language = N'R'
, #script = N'
current_model <- unserialize(as.raw(glmmodel));
new <- data.frame(NewMTCars);
predicted.am <- predict(current_model, new, type = "response");
str(predicted.am);
OutputDataSet <- cbind(new, predicted.am);
'
, #input_data_1 = N'SELECT hp, wt FROM dbo.NewMTCars'
, #input_data_1_name = N'NewMTCars'
, #params = N'#glmmodel varbinary(max)'
, #glmmodel = #glmmodel
WITH RESULT SETS ((new_hp INT, new_wt DECIMAL(10,3), predicted_am DECIMAL(10,3)));
I get the following error :
DECLARE #glmmodel varbinary(max) =
(SELECT model FROM dbo.GLM_models WHERE model_name = 'default model');
EXEC sp_execute_external_script
#language = N'R'
, #script = N'
current_model <- unserialize(as.raw(glmmodel));
new <- data.frame(NewMTCars);
predicted.am <- predict(current_model, new, type = "response");
str(predicted.am);
OutputDataSet <- cbind(new, predicted.am);
'
, #input_data_1 = N'SELECT hp, wt FROM dbo.NewMTCars'
, #input_data_1_name = N'NewMTCars'
, #params = N'#glmmodel varbinary(max)'
, #glmmodel = #glmmodel
WITH RESULT SETS ((new_hp INT, new_wt DECIMAL(10,3), predicted_am DECIMAL(10,3)));
I get the following error :
"Msg 39004, Level 16, State 20, Line 44
A 'R' script error occurred during execution of 'sp_execute_external_script' with HRESULT 0x80004004.
Msg 39019, Level 16, State 2, Line 44
An external script error occurred:
During startup - Warning message:
In setJsonDatabasePath(system.file("extdata/capabilities.json", :
bytecode version mismatch; using eval
Error in unserialize(as.raw(glmmodel)) : read error
Calls: source -> withVisible -> eval -> eval -> unserialize
Error in execution. Check the output for more information.
Error in eval(expr, envir, enclos) :
Error in execution. Check the output for more information.
Calls: source -> withVisible -> eval -> eval -> .Call
Execution halted
"
Is the error related to unserialize or is it related to"
During startup - Warning message:
In setJsonDatabasePath(system.file("extdata/capabilities.json", :
bytecode version mismatch; using eval

Objective C - Box2d float type casting: multiplying * operand on float32

Please help me in removing the error with explanation
Error on the following line:
_Sprite.position.x = _Body->GetPosition().x * _PhysicsWorld->RATIO;
Error message: Invalid operands to binary expression ('float32 (aka 'float') and 'float32()())
_Body is a B2Body object
_Sprite is a CCSprite object
_PhysicsWorld->RATIO returns float32
If I change the line to:
_Sprite.position.x = _Body->GetPosition().x * (float) _PhysicsWorld->RATIO;
Another error message comes: C-style cast from float32(*)() to float is not allowed.
You probably need to do:
_Sprite.position.x = _Body->GetPosition().x * _PhysicsWorld->RATIO();
Note the trailing '()' after RATIO.
You are multiplying a float (which parses into pointer dereferencing instead) by a function that returns a float (I believe).

Passing stored procedure to sp_send_dbmail

I am using sp_send_dbmail in SQL Server 2008 to send out the results of a query. I moved the query into a proc and am trying to use the proc in the sp_send_dbmail prcedure like so:
EXEC msdb.dbo.sp_send_dbmail
#profile_name = 'myprofile',
#from_address = 'email#somedomain.com',
#reply_to = 'email#somedomain.com',
#recipients = 'email#differentdomain.com',
#importance = 'NORMAL',
#sensitivity = 'NORMAL',
#subject = 'My Subject',
#body = 'Here you go.',
#attach_query_result_as_file= 1,
--#query_result_header = 1,
#query_result_width = 1000,
#query_result_separator = '~',
#query_attachment_filename = 'myFile.txt',
#query = 'EXEC dbo.myProc'
I have also tried this using 4 part naming on the proc; with and without the 'EXEC', etc. It worked fine as a query, but I cannot seem to get it to work as a proc. Is this even possible?
You need to add the database context:
#execute_query_database = 'MyDatabaseName',
I just ran this with no problems against AdventureWorks2008:
EXEC msdb.dbo.sp_send_dbmail
#profile_name = 'DBMail',
#recipients = 'mitch#domain.com',
#query = 'exec dbo.uspGetManagerEmployees 5' ,
#execute_query_database = 'AdventureWorks2008',
#subject = 'Work Order Count',
#attach_query_result_as_file = 1 ;
Have you tried creating a user-defined function instead of a stored procedure?
Something like:
#query = 'select something from dbo.myFunction()'