Error "... is not a recognized built-in Function name" in SQL Server

Asked

Viewed 2,186 times

2

I am not able to make an Insert in the SQL Server database. Follow my code:

INSERT INTO TB_Cadastro (Cod_Vac, CodIN,Produtor, Codmal, DataVac, DataCompra, NumDoc, SerieDoc, UFDoc, CodMunDoc, Lab, NumPartida, Validade, Revendedor, Doses, Qtde, Obs, tipo, Por, Qtde412Macho, Qtde1224Macho, Qtde2436Macho, Qtde36Macho, Qtde412Femea, Qtde1224Femea, Qtde2436Femea, Qtde36Femea, Campanha, CasaVet, CPFCNPJDoador, Origem, QtdeFiscalizada, TipoVacinacaoAnterior, Responsavel, NumTransfVac, ativo)
VALUES (5079,'5868','24936707287','',TO_DATE('2015-04-08 00:00:00','YYYY-MM-DD HH24:MI:SS'),TO_DATE('2015-08-04 00:00:00','YYYY-MM-DD HH24:MI:SS'),'072608 ','','14',1400100,'20557161000198','009/2014 ',TO_DATE('','YYYY-MM-DD HH24:MI:SS'),'11','30','','','','',6,1,0,0,3,2,14,2,'2/2015','','','','','5','','','');

SQL Error [195] [42000]: 'TO_DATE' is not a recognized built-in Function name. java.sql.Sqlexception: 'TO_DATE' is not a recognized built-in Function name.

3 answers

2

this error can also be solved by placing the name of your database schema. example: inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

2

TO_DATE is a usanda function in ORACLE, the corresponding sql server would be the use of Convert(datetime,'2015-04-08 00:00:00'), but this if its date was not in the correct form, as in the example here.

select
   convert (datetime, '20111019')
from _table

Another thing that could be using is the

SET LANGUAGE { [ N ] 'language' | @language_var } 

If the date shape was not in the same language as the database.

  • 1

    +1, did not know it was from Oracle. I corrected my answer.

1

The function TO_DATE, that you use 3 times, does not exist in SQL Server. Must be a custom function available in another BD, where this code originally came from. As GOKU taught, it is an Oracle function.

You are already using a data format that SQL Server understands, so you can simply replace cases like this:

TO_DATE('2015-04-08 00:00:00','YYYY-MM-DD HH24:MI:SS')

simply:

'2015-04-08 00:00:00'

Browser other questions tagged

You are not signed in. Login or sign up in order to post.