I am a novice user of PostgresQL. I found out in Internet interesting DB, which consists of 3 tables. Every of this table is in CSV format. However I could smoothly copy the first one to my sql database. Right now I have the following problem:
ERROR: invalid input syntax for type integer: "43950100,43950010,TUR,GUNES Senol (TUR),S,1,"RUSTU ",GK,"
CONTEXT: COPY worldcupsplayers, line 25645, column roundid: "43950100,43950010,TUR,GUNES Senol (TUR),S,1,"RUSTU ",GK,"
Every row in a table has the same structure, as follows:
43950100,43950010,TUR,GUNES Senol (TUR),S,1,"RUSTU ",GK,
I am wondering why in such row I have a problem (line 25645), while it looks as other ones.
I am trying to copy it with this command:
COPY worldcupsplayers(RoundID, MatchID, team_initials, coach_name, line_up, shirt_number, player_name, position, event)
FROM 'C:\Users\Public\worldcup\worldcupplayers.csv'
DELIMITER ','
CSV HEADER;
[table structure]
UPDATE: rows above and below
25643 - 43950100,43950008,SVN,KATANEC Srecko (SVN),N,23,BULAJIC,,
25644 - 43950100,43950010,BRA,SCOLARI Luiz Felipe (BRA),S,1,MARCOS,GK,
25645 - 43950100,43950010,TUR,GUNES Senol (TUR),S,1,"RUSTU ",GK,
25646 - 43950100,43950010,BRA,SCOLARI Luiz Felipe (BRA),S,2,CAFU,C,
As u may see they are all the same, with the commas every row has the same structure.
This is my table:
I want to change the TargetCondition column to 'TRUE' when the ICD9CODE column contains a particular range (like between 250 and 250.93).
Please help me do it. Thanks
This is the code here:
update demo.fea_02 set TargetCondition = TRUE where ICD9Code like between '%250%' and '%250.93%'
got the error:
Syntax error: Unexpected keyword BETWEEN at [6:17]
This answers the original version of the question.
You would use update:
update mytable
set targetcondition = 'TRUE'
where icd9code like '%value%';
UPDATE ASSIGNMENTS SET CBTURL = REPLACE(CBTURL, 'http://172.21.130.19/', 'https://testlpsweb.corp.mbll.ca/Content/')
The above statement produces "Data truncation" error. Please advise why and how to correct it.
Error starting at line : 1 in command - UPDATE ASSIGNMENTS SET CBTURL = REPLACE(CBTURL, 'http://172.21.130.19/', 'https://testlpsweb.corp.mbll.ca/Content/') Error at Command Line : 1 Column : 1 Error report - SQL Error: Data truncation
I'm guessing that CBTURL column length is to small for resulting string of replace. Could you try to alter column to have larger lenght.
Try this query to see maximum resulst string lenght:
Select Max(Len(REPLACE(CBTURL, 'http://172.21.130.19/', 'https://testlpsweb.corp.mbll.ca/Content/'))) from tablename ....
I am having some trouble trying to update a field.
I created a column as text and stored many rows with (lon,lat). Now I have created one more field as Geometry(Polygon) and I am trying to update it unsuccessfully.
The data is stored like this:
POLYGON ((-16.6318775869111 -52.5925428149806, -16.6346393504709 -52.572542814981
, -16.629462102066 -52.5525428149806, -16.6255191065928 -52.5455420519144
, -16.6055191065928 -52.5488828022871, -16.6021791014778 -52.552542814981
, -16.6108484688169 -52.5925428149806, -16.6255191065928 -52.599495926874
, -16.6318775869111 -52.5925428149806))
I am trying this command
UPDATE field_as_text
SET field_as_geomtry = SELECT ST_GeomFromText(SELECT field_as_text);
I am getting this error message
ERROR: syntax error at or near "select"
LINE 1: ... set field_as_geomtry = select (ST...
Could anyone enlighten me?
You need to start by reading the manual about the SQL UPDATE command.
Should look something like this:
UPDATE table_name
SET field_as_geomtry = ST_GeomFromText(field_as_text);
I am trying to create my first procedure on firebird 2.5 by using ibexpert gui.
The procedure will return 'PROCESS_DATE' which belongs to a specific 'PROCESS_ID'. I prepared following code:
begin
OUTPUT_DATE = (select PROCESS_DATE from PROCESSES
where PROCESS_ID = INPUT_ID);
suspend;
end
input parameter : 'INPUT_ID' --> type 'INTEGER'
output parameter : 'OUTPUT_DATE' --> type 'DATE'
But when I tried to compile it returns this error:
Column does not belong to referenced table.
Dynamic SQL Error.
SQL error code = -206.
Column unknown.
INPUT_ID.
At line 9, column 48.
I do not know how to deal with this error.
I tried to find solutions on other questions also the internet but i couldn't find a basic, understandable answer for beginners. thanks for helps.
Try this:
CREATE PROCEDURE MyP (INPUT_ID INTEGER)
RETURNS (OUTPUT_DATE DATE)
AS
BEGIN
FOR
SELECT PROCESS_DATE FROM PROCESSES
WHERE PROCESS_ID = :INPUT_ID
INTO :OUTPUT_DATE
DO
SUSPEND;
END
Always prepend parameter names with ":". The only place where ":" is not allowed is at the left side of "=" operator.