Why does SQL Server say it can’t convert varchar to numeric?

I have the following schema/data in MSSQL Server 2019 (SQLFiddle):

CREATE TABLE products(     idn NUMERIC(9) PRIMARY KEY );  CREATE TABLE sales(     idn NUMERIC(9) PRIMARY KEY,     pid VARCHAR(50) NOT NULL,     type VARCHAR(10) NOT NULL );  INSERT INTO products (idn) VALUES (1); INSERT INTO sales (idn, pid, type) VALUES (1, 1, 'number'); INSERT INTO sales (idn, pid, type) VALUES (2, 'Colgate', 'word'); 

sales has mixed data i.e VARCHAR and NUMERIC. The transaction filter takes care of JOINing correctly.

Why does the following SELECT fail?

SELECT      *  FROM      products      INNER JOIN sales ON products.idn = sales.pid      AND sales.type = N'number'  WHERE      products.idn in (1);  

I don’t see why casting NVARCHAR to NUMERIC is an issue:

SELECT CAST (N'1' as NUMERIC); 

If I modify the query slightly it works:

SELECT      *  FROM      products      INNER JOIN sales ON products.idn = sales.pid      AND sales.type = N 'number'  WHERE     -- Selecting the same data from `sales`.     sales.pid in (1);  SELECT      *  FROM      products      INNER JOIN sales ON products.idn = sales.pid     -- Dropping the `N` prefix.     AND sales.type = 'number'  WHERE      products.idn in (1);  

How to convert this if-clause condition to a linear programming optimization problem

Let’s consider the following conditional constraint. w is a set of input data. x,y(1:3),d(1:3) are the decision variables.

x= 3.9         % optimization variable (one can iterate over it 0<x<5 ) for i=1:3     if w[i]-x <=0          d[i]=x-w[i];         y[i]= w[i]     else         d[i]=0         y[i]=w[i]     end end 

The linear expression of the above constraint can be expressed as follows:

Max $ 40𝑥+15𝑦_1−30𝑑_1+15𝑦_2−30𝑑_2+15𝑦_3−30𝑑_3$

$ x_i – y_i <= d_i, i=1:3$

$ y_i = w_i , i=1:3$

$ 0 <= x <= 5$

$ y,d_i>= 0, i=1:3$

However, I want to change the conditional constraint as follows:

for i=1:3         if w[i]-x <=0              d[i]=x-w[i];             y[i]= w[i]         else             d[i]=0             y[i]=x    % The change         end end 

How can I modify the linear optimization problem to satisfy the new condition?!

convert RE to NFA

The Regular Expression i am having trouble with is the following a(b|bcc*)*c. My main concern is what do i do with the c*? I can lay the rest of the diagram correctly (i think) but that part is beyond me. Any help would be great, thank you. What i have: enter image description here

How to convert NPDA to PDA?

I have been given this Nondeterministic pushdown automata and I need to convert it to deterministic pushdown automata, I have been stuck with this for a while now, I know that there cant be transitions where the pda doesnt read anything from the stack but i dont know how to solve this. NPDA

Thanks in advance!

How can I best convert an Oath of the Ancients paladin from D&D 5e to 3.5e?

I’m working on starting a D&D 3.5e campaign with a group of players with whom I’ve previously played a 5e campaign. One of these players plays a 5th-level Paladin with the Oath of the Ancients in our 5e campaign, and would like to play a similar style of character in the 3.5e campaign. My question is how to best convert the character over from 5e to 3.5e while preserving the character’s essence in play.

For context, this player plays the paladin as a lightly armored half-elf with a longsword and shield, emphasizing the ability to smite for lots of damage fast. The character has also made some use of the lay on hands ability, but otherwise has made fairly negligible use of spells due to everyone else in the party also having some spellcasting ability.

My first thought on how to convert the character was to use a Duskblade, since the arcane channeling ability provides a similar strong strike style effect as the Paladin’s smite ability in 5e. I preferred Duskblade channeling over Paladin smites because the smite in 3.5e is quite lackluster and nowhere near as repeatedly usable, especially at low levels. However, the Duskblade would not provide any healing ability, and lacks the divine flavor of the paladin. These aren’t insurmountable problems, but I am hoping for a better fit.

Is there an option that better fits the playstyle of a Good, lightly armored, sword-and-shield character with fast and highly damaging attacks and the ability to heal at 5th level?

How to convert a range of 0 – 1023 to 0 – 255? [closed]

Hi smart community,

I am stuck with a problem where I get an input somewhere between the range of 0 to 1023 and I want to give an output ranging between 0 to 255 as per the input value. How should I do it? Quick note that I don’t want to use any libraries only for my own satisfaction.

I do find kind of similar questions already answered but I would rather welcome an explained derivation to the formula you provide. Thanks very much 🙂

How can I convert a Classic Slideshow to an ordinary notebook?

I have several Classic Slideshow presentations originally created 3 or 4 years ago. I would like to convert these to ordinary Mathematica notebooks, removing all the slideshow-related paraphernalia including page breaks, etc.

If I simply select Format > Stylesheet > Default, the separate slides are still there, labelled “Slide 1 of 34” etc.. Is it then just a matter of manually removing all the page breaks, or is there more to it?

Related to this, (though it’s not what I want to do at present), what is the best way to convert from a classic slideshow to the newer Presentation style? Will Format > Stylesheet > PresenterTools do the job correctly?

How to Convert Alternity Character to High-Level D&D 5e Character?

I’m wanting to do my best to create a level 15-20 ish D&D 5e character heavily based on a high-level character from Alternity. I do not mind if it’s based more on the newer (2017) version of Alternity or the older (1997) version (or both).

I’ve done some basic perusing through various forums and wiki’s to gain some understanding of what Alternity is and roughly how it is played, but other than that, I’ve never played it. The closest RPG I’ve played in theme is Shadowrun, but otherwise I’m an avid D&D 5e player/DM.

How would you create a character in D&D 5e that was made to look/feel/act like a character out of Alternity? Tips/advice and especially examples would be greatly appreciated! Thanks!

Convert private SSL certificate to PKCS12 format for JKS Keystore [migrated]

I got the following files from company certificate provider.

jenkins.int.XX.com.key XX_Inc_Private_Root_CA.base64.cer XX_Inc_Private_Root_CA.crt XX_Inc_Private_SSL_CA.509.cer XX_Inc_Private_SSL_CA.509.pem 

Here is the two commands I run to convert:

openssl pkcs12 -export -out jenkins_keystore.p12 -passout 'pass:changeit' -inkey jenkins.int.xx.com.key -in XX_Inc_Private_Root_CA.base64.cer  error message: No certificate matches private key    openssl pkcs12 -export -out jenkins_keystore.p12 -passout 'pass:changeit' -inkey jenkins.int.xx.com.key -in XX_Inc_Private_SSL_CA.509.cer  error message: unable to load certificates  

What is the right way to do it?