Αποτελέσματα Αναζήτησης
12 Απρ 2018 · Como posso fazer um insert com uma condição where? Tenho a seguinte query: INSERT INTO `registro`(`id`, `username`) values ('','USER_1'), ('','USER_2'), ('','USER_3') Ele vai adicionar um novo usuário na tabela registro. Só que eu preciso que ele verifique se esse usuário já existe no DB, se já existir ele não deve inserir.
18 Ιουν 2012 · This is the only one that works for my (shared) SQL server. YYYY-MM-DDThh:mm:ss gives the correct mnth/date; but without the 'T' (YYYY-MM-DD hh:mm:ss) the month and date are swapped (sometimes of course giving impossible values), Without the hyphens (YYYDDMM hh:mm:ss) also seems to work but I can't trust it, because it depends on the DB admin's language settings which may change.
Else if you are trying to insert a new row then you have to use. IF NOT EXISTS(SELECT 1 FROM Payments WHERE CustomerID = '145300') INSERT INTO Payments(CustomerID,Amount) VALUES('145300',12.33) Or if you want to combine both command (if customer exists do update else insert new row)
16 Δεκ 2009 · Above is the JSON object and below is the SQL Query that insert data into MySQL. let query = `INSERT INTO brand (reward_name, short_description, terms) VALUES (${brandDetails.rewardName}, (${brandDetails.shortDescription}, ${brandDetails.terms})`;
23 Δεκ 2023 · I Just learned about this OUTPUT INSERT feature, that looks like the real answer, works very well in sqlserver, but doesn't work with SqlClient class, it throws System.Data.SqlClient.SqlException: 'Cannot find either column "INSERTED" or the user-defined function or aggregate "INSERTED.Id", or the name is ambiguous.', I'm raising a question in other thread so if anybody knows the solution ...
25 Νοε 2020 · After having created a temporary table and declaring the data types like so; CREATE TABLE #TempTable( ID int, Date datetime, Name char(20)) How do I then insert the relevant data which is already ...
17 Ιαν 2009 · In SQL Server 2008 you can insert multiple rows using a single SQL INSERT statement. INSERT INTO MyTable ( Column1, Column2 ) VALUES ( Value1, Value2 ), ( Value1, Value2 ) For reference to this have a look at MOC Course 2778A - Writing SQL Queries in SQL Server 2008.
25 Αυγ 2008 · Although this is entirely feasible for many database engines, I always seem to struggle to remember the correct syntax for the SQL engine of the day (MySQL, Oracle, SQL Server, Informix, and DB2). Is there a silver-bullet syntax coming from an SQL standard (for example, SQL-92 ) that would allow me to insert the values without worrying about ...
20 Οκτ 2017 · O execute está disponível no SQL Server 2008 em diante. No Oracle, temos o comando execute immediate , disponível a partir do 10g Release 2 (10.2). Já nesta forma, você precisará montar uma string com sua query montando o insert exatamente como necessita.
It's not as if the SQL Server evaluates the subquery first and then at some later point, and without holding a lock, goes on to do the insert. – Ed Avis Commented Aug 17, 2017 at 11:40