I use this code for select columns
select cities.name,cities.geom,cities.area
from cities,delivery
where ST_Intersects(delivery.geom,cities.geom)
It return this result
How i can set value "true" for "area" column?
I am not familiar with the language - tell me how to set the values? Biggest thx!
update cities set area = 'true'
from delivery
where ST_Intersects(delivery.geom,cities.geom);
Related
I have a table of user preferences - 'pr_gantt_config' and a table of default values for all the configurable elements of the chart - 'pr_gantt'. I was hoping this query would return either the user expressed the preference or the default value from pr_gantt for all configurable values but I only get the rows where the user has expressed preference. I know I could store a value for each user against each value, but that feels inefficient.
SELECT `code`,
`pref`,
`type`,
Ifnull(`pref`, `pr_gantt`.`default_value`) AS `pref`
FROM `pr_gantt_config`
LEFT JOIN `pr_gantt`
ON ( `pr_gantt_config`.`gantt_id` = `pr_gantt`.`id` )
WHERE `pr_gantt_config`.`user_id` = '1'
Your help greatly appreciated.
A work arround would be to first create a view of both tables.
CREATE VIEW temp AS
SELECT code, pref, type,pref, pr_gantt.default_value FROM pr_gantt_config
LEFT JOIN pr_gantt ON (pr_gantt_config.gantt_id = pr_gantt.id) WHERE
pr_gantt_config.user_id = '1'
and then select with IFNULL
SELECT code,type, IFNULL(pref, pr_grannt.default_value) FROM temp
For Ex:In RDLC, I have a Grid with the following columns
period,
Quantity,
description etc..
I will get Period values as dates and one value as "Avg", Now when My Period Value is "Avg", I want to hide that row from Grid in RDLC report.how can i do this?
I tried like below:
Row Visibility -> Show or Hide Based on Expression ->
(Fields!Period.Value = "Avg", True, False). But it is not working.
Please help me in this regard....
I would recommend to check actual values of Period field. Also, expression for Visibility in this case should start with equal sign and IIF (in case you didn't just copied it partially):
= IIF(Fields!Period.Value = "Avg", True, False)
I want to filter out the output without rows containing null values or blank columns. I am using SQL Server 2012 there is no option named 'Blank' as in SS2005 where I can filter the rows. I also tried following expression but it gives me error or not showing correct output
=IsNothing(Fields!ABC.Value)!= True
=Fields!ABC.Value = ''
Please suggest the solution.
Pull up the tablix or group properties
Switch to "Filters"
Add a new filter
Set the expression to:
=IsNothing(Fields!YourFieldHere.Value)
Set the type to "Boolean" (see screenshot below) otherwise you'll get a "cannot compare data of types boolean and string" error.
Set the value to false
This works for filtering both rows and groups.
We should use the isNothing method in the Expression, change the Text to Boolean
and then Value will be "True"
for example:
Expression
=IsNothing(Fields!TestA.Value)<>True
(Expression type should be Boolean)
Operator
=
Value
=True
Edit the SQL query, so that it will not return NULL values in the column to group on, but let it return a dummy value; for example: ISNULL(columnA, 'dummy')
In the column group definition add a filter: ColumnA <> 'dummy'.
I have a SP with which I fetch a defined amount of rows. How can I change the value of a column in the fetched rows? Such as 'has been fetched' = 1.
Any advice?
EDIT:
The SP looks something like this
SET ROWCOUNT #numberOfRows
SELECT * FROM tableA where notSent = 1
I would like to change the 'notSent' colum for all the rows that i fetch. Is this possible?
1) Don't use Select * in a stored procedure - always specifically list the fields required as shown below - replace field1,2,3 etc with the actual fields you want returned.
OK - Modified answer:
2) Set a flag on the columns you want to select and update with a value that will not be otherwise programmatically set - e.g. -1 - Then select these records, then update them to set the final value required. Doing it this way will avoid the possibility that you will update a different set of records to those selected, due to inserts occurring half-way through the stored procedure's execution. You could also avoid this by use of locks, but the way below is going to be far healthier.
UPDATE Table set notSent = -1 WHERE notSent = 0
SELECT ... from Table where notSent = -1
UPDATE Table set notSent = 1 where notSent = -1
I have a SSRS report that works with boolean parameter. I would like to add a third option to show all the records on the report. Both true and false. The concept is that the dropdown will include three options (All,True,False).
Is there a way to acheive that?
Thanks,
-Y
Set the dataset filter to something like this:
I have 3 available values for #parmTRUEFALSE
False = False
True = True
All Records = (Null)
=IIF(IsNothing(Parameters!parmTRUEFALSE.Value), ObjectFieldName.Value, Parameters!parmTRUEFALSE.Value)
If the user selects All Records... the filter uses ObjectFieldName.Value and returns all records because #parmTRUEFALSE = (Null) / IsNothing
Select Allow multiple values:
Then add the desired values:
Then add a new filter and convert the field value to String:
Then select the IN operator: