Questions tagged as 'sql-server'

0
answers

How to model tables to store tag

I have a SQL Server database where I have a table of videos linked to several tags. As it is done here in the forum where each post is linked to several tags. What is the best practice for modeling the database? At first I thought of so...
asked by 01.02.2018 / 21:47
1
answer

INSER lock trigger with condition and error message

I would like to create a Trigger with a condition that just did not generate payment postings for an expecifico financial controller code in the system and that the others let pass and when it did not generate for the expecifico code an error me...
asked by 01.02.2018 / 14:18
3
answers

Create trigger with update setting field through a function

I want to use a trigger to update the field of a table whenever there is an insert in this table. The problem I'm having in the trigger is that the update does not work, it follows the trigger: CREATE TRIGGER descNF ON tabela1 AFTER...
asked by 07.02.2018 / 01:25
1
answer

Error converting date and time Query SQL Server

Well, I'm trying to run the query below, however, the following error is occurring. "Failed to convert string date and / or time.". I have already done some other conversions, but without success. select MesID,Mes,Ano, cast(SUM(DateDiff(MI...
asked by 29.01.2018 / 18:46
1
answer

Change WHILE by GROUP in SQL

I need an SQL function to get data grouped by month. I have in the column CPCCodeID codes (ex: 512456). I need to count and group for the first two digits. I need this separated for months (!!!) and to make it easier I did this loop that...
asked by 30.01.2018 / 17:38
0
answers

HTML field accepts only the numbers of a Query (SQL-Server)

I have the following field: Código da Receita: <input type="text" name="cod_receita"> and would like it to accept only the numbers for this query: SELECT distinct orcplare.codigo FROM rectotor INNER JOIN orcplare ON (...
asked by 30.01.2018 / 15:57
1
answer

Error executing script

I'm trying to run the query below, but the following error occurs. "Converting a varchar data type to a datetime data type resulted in a value out of range." select MesID,Mes,Ano, convert(time,dateadd(second,SUM ( DATEPART(hh,(convert(...
asked by 30.01.2018 / 16:29
0
answers

automatic platform for database in windows (sql server)

Good! I needed an automatic graphical platform for a sql server database on windows.     
asked by 31.01.2018 / 17:13
1
answer

Java @GeneratedValue + SQL server NEWID + Hibernate

I have a table that has ID set to CREATE DEFAULT ID_Tabelas AS NEWID() , that is, even if I use an insert without the key, it will be generated automatically. How can I do with hibernate to recognize that the database itself will generate...
asked by 24.01.2018 / 11:44
1
answer

Error executing SUM - SQL Server

Well, I'm trying to do SUM according to the query below, however, the following error occurs. "You can not perform an aggregate function on an expression that contains an aggregation or a subquery." The output is to exit this way. Total_Horas...
asked by 24.01.2018 / 13:27