how can I assign a name to the result using Wolfram|Alpha Query in order to use it in the next line of code?
Solve[\[CapitalAlpha] == E + \[Beta]\[Lambda](\[Pi]+\[Beta]\[CapitalBeta]\[CapitalAlpha])/(1-\[Beta]+\[Beta]\[CapitalBeta])+\[Beta](1-\[Lambda])(\[Alpha]+\[Beta]\[CapitalChi]\[CapitalAlpha])/(1-\[Beta]+\[Beta]\[CapitalChi]), \[CapitalAlpha]]
In the next line I want to set A equal to something.
Thank you for your help!
Related
So assume there are 2 cols Name and Flag. I want to change the name of the data which have flag=1.
This is the table (https://i.stack.imgur.com/LILzV.png)
And this is what i want.(https://i.stack.imgur.com/JPZWj.png)
I have first created a flag according to some condition. Now im not able to fig out the next move.
update TableName
set name = 'zumba'
where flag = 1
Edit: as pointed out by jarlh, single quotes are the correct syntax
Incrementing the value of a variable by one is often achieved in other basic dialects in ways like
myreallylongandawkwardvariable ++
or
inc(myreallylongandawkwardvariable)
Is the only way to achieve this in VBA to code like this?
myreallylongandawkwardvariable = myreallylongandawkwardvariable +1
That is the only standard way to increment a variable with VBA.
If you really want to, you can create a custom procedure:
Sub Increment(ByRef var, Optional amount = 1)
var = var + amount
End Sub
Then you can do the following:
Increment myreallylongandawkwardvariable 'Increment by 1
Increment myreallylongandawkwardvariable, 5 'Increment by 5
#DanBaeckström, that is Not strictly correct.
If you call a procedure simply by its name, as in:
Increment myreallylongandawkwardvariable
you don't use parentheses.
But, if you precede this procedure call with the keyword "Call", as in:
Call Increment(myreallylongandawkwardvariable)
you MUST use parentheses.
I've got a SQL Server table in which I have a column where I would like to select the current value and increment by one, is there a way to do this in a single query? This in order to mitigate the chance, however small it might be, that someone else gets the same number.
Something along the lines of this pseudo code:
SELECT NumSeriesCurrent
FROM NumSeries
(UPDATE NumSeries SET NumSeriesCurrent = NumSeriesCurrent+1)
WHERE NumSeriesKey='X'
To update the value and get the value in NumSeriesCurrent previous to the update you can use
UPDATE NumSeries
SET NumSeriesCurrent += 1
OUTPUT DELETED.NumSeriesCurrent
WHERE NumSeriesKey='X'
I have a db where one column contains 2 pieces of data, e.g. first and last name.
The format is roughly ABC-1D23-4F34
I want to copy and insert the first 3 letters, the ABC, into a new column. Lets call these columns [full_id] and [ref_id]
From reading it looks like substring is able to do this but I am doing something wrong here.
INSERT INTO [ref_id]
SUBSTRING([full_id], 1, 3)
FROM db.Name
Thank you for the help.
EDIT:
The update string worked. But I found that there are issues with my data and it is not all in proper formatting.
Is there a way to write a case where if the substring is not 3 letters it writes a null value?
Thanks again, and sorry for having bad data.
Try
UPDATE Name
SET ref_id = CASE WHEN CHARINDEX('-',full_id) = 4 THEN SUBSTRING(full_id,1,3) ELSE NULL END
That will set the ref_id column for all rows using the first 3 characters of the full_id column.
If it is a column in the same table you need to switch to an update statement.
UPDATE db.Name SET [ref_id] = SUBSTRING([full_id], 1, 3)
Perhaps you want something like:
Update db.Name set ref_id = substring([full_id], 1,3)
I have 3 fields in my table: start, end (dates) and length (number, might be blank).
My Aim is to calculate an end date using start and length where end doesn't exist...
I have:
SELECT Switch((g.length<>0) And IsDate(g.end),DateAdd("m",g.length,g.start)) AS field FROM table g
If there is no start, end or length, Access displays blank - this is fine.
If there is no end, but start and length are ok, the calculated date is shown - again fine.
BUT
If there is no end, or length, but a start exists, access displays #Error
I don't understand why, and can't fix it, please help!
If there is no end, but start and length are ok, the calculated date is shown
Are you certain about that point? When I try your query with values for start and length, but no value for end, I get a Null for "field".
Also, you're calling the DateAdd function when this condition is True:
g.length<>0) And IsDate(g.end)
In order for that condition to be True, g.end would have to already contain a valid date ... but I thought you didn't want to perform the calculation when you already have a value for g.end. I'm confused.
Let's try a different approach. If this query returns what you want, good. If not help us understand why it is incorrect.
SELECT
d.start,
d.end,
d.length,
IIf(IsDate(d.end), d.end,
IIf(Nz(d.length)>0, DateAdd("m", d.length, d.start), Null)) AS field
FROM table AS d;