Questions tagged as 'sql-server'

1
answer

Query about fix c #

I am running stored procedures in my project WCF C# . From one of my SP I receive something like this: CeldaId CeldaIndicadorCodigo CeldaIndicadorTipoCodigo Then with the value of Celda Id I call another SP that brings me: Ce...
asked by 25.10.2016 / 15:50
1
answer

How to make several queries with the same fields but different data in the tables?

I would like to join two tables with the same fields but they have leaders loaded in their tables. example select folio,'ALUMNO' AS ent_sal, observaciones from ALUMNO where activo='0' Y select folio,'MATERIA' as ent_sal, observaciones...
asked by 08.08.2016 / 16:05
1
answer

ERROR Converting data types to SQL Server

I start by explaining my problem, my database is an inventory and as such I have products and categories, so each product belongs to a different category. I want to make a query where I can count the number of products that each category has and...
asked by 03.09.2016 / 22:44
1
answer

Replace SQL - Replace special SQL characters with function

I need to replace some special characters using SQL 2008, for that to generate a function. This is the -sql- part where the replacement is made: set @raw = replace(replace(@raw,'&lt;br /&gt; * ','<br/>*'),'&amp;nbsp;','...
asked by 18.10.2016 / 01:47
1
answer

use of rollback before making changes in a sql table

The rollback is to undo change in a table when a deletion or update is done, my question is How is its use for an update that I want to do?     
asked by 29.08.2016 / 16:34
1
answer

Custom SQL Server Audit Table

I need to make a trigger, that I insert in an audit table, the name of the table, the date and the type of action that is performed, this trigger must be executed at the database level after an UPDATE, INSERT or DELETE of any of the tables in th...
asked by 27.10.2018 / 20:36
1
answer

Change null values to '0' in a SQL pivot

I have something more or less like that select * from( selcect ...)as pt pivot( asc(valor) for desc in ( [Deporte y cultura],[Despensa],[Destajo - sueldo], [Destajos], etc ...) ) as pvt So far so good, but I get many results as null from...
asked by 19.09.2018 / 18:59
1
answer

How can I give privileges to SQL SERVER sessions?

I was investigating and I have a question. I know that to create a session is: CREATE LOGIN user WITH PASSWORD = 'pass'; And my question is: How do I give read and write privileges and assign a table to that user with SQL code?     
asked by 28.09.2016 / 01:23
1
answer

Doubt over IF SQL and check if a select returns records [closed]

In a table called pacientes I have a Juan , which is varchar (4) . My if has the following inconvenience Juan can be Pedro or José . That is, this name can vary many times I need a IF that...
asked by 24.09.2016 / 03:23
1
answer

Verifying if previous registration already exists (SQL server 2008 r2)

I have the following script with more than 20,000 records in each table: With registration dates from January to February 2018: INSERT Table_que_usare (Usuario, IDUnica, servidor) select Usuario, IDUnica, servidor from table1 With regist...
asked by 07.08.2018 / 00:06