sqlerror help please [closed] - sql

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
insert into dbo.leerlingen
('1',
'Reduan de Boer',
'postweg12',
'4589 vb',
'zelhem',
'23841')
when i type this in i get this error can anyone help me please
Msg 102, Level 15, State 1, Line 7 Incorrect syntax near ')'.

You are missing the values keyword to introduce the list of values to insert:
insert into dbo.leerlingen values('1', 'Reduan de Boer', 'postweg12', '4589 vb', 'zelhem', '23841')
--^--> here
Note that it is a good practice to enumerate the columns that you want to insert into: this makes the query easier to read to someone who does not know your table structures. Also, if new columns are added that are nullable, you don't need to modify the query.
insert into dbo.leerlingen(id, name, ...) --> enumerate all target columns here
values('1', 'Reduan de Boer', 'postweg12', '4589 vb', 'zelhem', '23841')
Finally: some of your values look like numbers - if they are, then you should not surround them with single quotes (which are typically meant for strings). This makes the intent more obvious, and avoids the need for implicit conversion on database side.

Related

I'd like to insert any value using 'insert into' but it doesn't work. What is "Column not found error"? [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I created table "member". It has two columns name, id and no values. And I'm trying to insert value "spring" into column name!
But It doesn't work...Can anybody help me please?
I wrote like this:
insert into member(name) values("spring");
error is:
Column "spring" not found; SQL statement:
insert into member(name)
values("spring") [42122-200] 42S22/42122
You should use single quotes for your String/Varchar values.
Try this query:
insert into member(name) values('spring');

Postgres Error : syntax error at or near "(" [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 1 year ago.
Improve this question
I am getting this error
ERROR: syntax error at or near "("Position: 65```
for the following query
insert into Employee(no,name,phone) values ((1,Kenit,999999999)(2,Kenit,999999999)(3,Kenit,999999999)(4,Kenit,999999999)(5,Kenit,999999999)(6,Kenit,999999999))
Probably you need commas between paranthesis for each record. And "Kenit" should be in quotes
insert into Employee(no,name,phone) values ((1,'Kenit',999999999),
(2,'Kenit',999999999),(3,'Kenit',999999999),(4,'Kenit',999999999),
(5,'Kenit',999999999),(6,'Kenit',999999999))
Try googling.
Source: https://www.sqlservertutorial.net/sql-server-basics/sql-server-insert-multiple-rows/
INSERT INTO table_name (column_list)
VALUES
(value_list_1),
(value_list_2),
...
(value_list_n);
INSERT INTO Employee (no,name,phone) VALUES ((1,Kenit,999999999),(2,Kenit,999999999),(3,Kenit,999999999),(4,Kenit,999999999),(5,Kenit,999999999),(6,Kenit,999999999));
happy to help
also: phone numbers should be saved in strings, as well as your names. so adding quotation marks helps not only in readability of the code it gives required LOGIC:
example:
...('asdf', 123, '+8920841209')

mistake in sql statement [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I am trying to insert data into a table.
This is my SQL statement:
INSERT INTO Employee.dbo.Humanresources (NationalIDNumber, JobTitle, BirthDate, Gender, Hiredate)
VALUES ('131456714','Finanace Manger', '1968-06-17', ' M','2019-05-15'),
('154236172', 'Data Analyst' , '1970-01-14', 'F','2006-04-18'),
('207126133', 'Assistant Manager', '1989-11-15', 'M','2016-07-19'),
('319327624', 'Team Laed', '1991-12-01', ' F',' 2016-06-25')
but I'm getting an error:
Msg 8152, Level 16, State 4, Line 36
String or binary data would be truncated
Please let me know what I did wrong
Is Hiredate a date/datetime field or a 10-character string? If it's a 10-character string, it looks like you have a leading space in the last value shown above. You're also missing the final closing parentheses.

SQL Update sot issue [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 2 years ago.
Improve this question
I am trying to update the cost of an item in our database:
UPDATE dbo.PartMaster
SET Cost = ‭0.0017178141193889‬
WHERE PartNumber = '93275K12'
I am getting an error
Msg 102, Level 15, State 1, Line 2
Incorrect syntax near '‭'.
The Cost is of float type. I have updated costs before without issue. But cannot find what the syntax issue is. Please help
copy/paste into something like NotePad++ and make sure all hidden characters are visible. I've seen this a lot when copying/pasting values from emails, there are hidden characters that SSMS can't show.
or if that doesn't show anything, open in a new tab and re-type it all without copy/pasting. (only 3 lines so not a big job)

"quoted string not properly terminated" sqlplus [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
Getting an error when I try to insert values using the following statement
INSERT INTO PRODUCT (PRODUCT_NUM, ITEM_NUM, DATE)
VALUES (’11’,’19’, TO_DATE(’01-JAN-2001’,’DD-MON-YYYY’));
ERROR:
ORA-01756: quoted string not properly terminated
Your question has "smart" quotes in the SQL instead of basic single quotes. Try this:
INSERT INTO PRODUCT(PRODUCT_NUM, ITEM_NUM, DATE)
VALUES ('11', '19', DATE '2001-01-01')
(I prefer the date keyword for specifying date constants in Oracle.)
INSERT INTO PRODUCT (PRODUCT_NUM, ITEM_NUM, DATE)
VALUES ('11','19', TO_DATE('01-JAN-2001','DD-MON-YYYY'));
use this code as you used wrong quote type
It's almost certainly because you're using the wrong quote types, something that often happens when you cut'n'paste text from a word processor.
Your example has "angled" quotes rather than the correct ' variant, meaning that either that's the actual problem, or that you've transcribed it incorrectly which leads me to think you're not matching quotes correctly.
This is what you should have:
INSERT INTO PRODUCT (PRODUCT_NUM, ITEM_NUM, DATE)
VALUES ('11','19', TO_DATE('01-JAN-2001','DD-MON-YYYY'));
use a normal quote, your quote seems to be odd.