Questions tagged as 'sql-server'

2
answers

Change the last part of the e-mail domain to a random varchar

Hello I'm looking for a way to mask emails in the database, but in a way that I can revert to them without much difficulty if I need the actual email. My idea is to create a AFTER INSERT trigger for this. Will not be used in production en...
asked by 15.08.2018 / 20:51
1
answer

How to return the table values using the SUM () function?

I have the following tables CREATE TABLE tbCliente ( ClienteID INT IDENTITY(1,1) PRIMARY KEY, ClienteNome VARCHAR(50), ClienteTelefone VARCHAR(15), ClienteDataCadastro DATE) CREATE TABLE tbPagamento ( PagamentoID INT IDENTITY(1,1) PRIM...
asked by 14.12.2018 / 00:55
3
answers

How do I store more than one value in an "SQL variable"?

I work with a system that has a very limited report builder. The reports are basically restricted to a SQL query. I need to present a query in a report that, in my query, the user is being informed by a multi-selection parameter, I will expl...
asked by 29.11.2018 / 01:04
1
answer

What is parameter sniffing?

I've heard of parameter sniffing. Something to do with SQL Server, stored procedures, and parameters. But what exactly is it?     
asked by 08.02.2014 / 19:43
3
answers

SQL - Bring only 1 year records back

I'm trying to make a SELECT that brings me only customers who have not bought for 1 year back without duplicating the client. Below the code I'm trying to do: SELECT DISTINCT p.ID, p.Nome_Fantasia, v.Data from Venda v inner join Cliente cl...
asked by 24.04.2018 / 16:08
3
answers

Do UPDATE with values from another table, in columns with the same name

I have the following table and B tables, these tables have about 20 identical columns. What I need to do is to update the values of table_B to partidar of table_A, where the columns are the same. Is there a way to automate the UPDATE proc...
asked by 03.02.2016 / 18:02
1
answer

How to traverse a SELECT rows in a STORED PROCEDURE in SQL Server?

Without using CURSOR and WHILE in SQL Server , what other ways would you be able to traverse the result lines of a SELECT to a STORED PROCEDURE ?     
asked by 13.02.2016 / 09:11
2
answers

How to define "charset" of a table in SQL Server?

In MySQL to set the charset of a table we can use this way: MySQL: create table user_details (...) default character set = utf8; How can I do the same in SQL Server?     
asked by 07.04.2016 / 14:46
1
answer

Embedded database with C # [closed]

I'm developing a local desktop application. As there will be no database servers, I have studied some, such as Firebird, SQLite, Access and even Localdb. But I still feel "lost" in which to work. I know the general choice is SQLite, but I did no...
asked by 06.11.2015 / 13:45
2
answers

Change numeric field precision SQL SERVER

I am experiencing a problem when changing the precision of a numeric column in a SQL SERVER table. The field is like NUMERIC(5) and I would like to change it to NUMERIC(5,2) , but it is displaying the message below I used A...
asked by 09.07.2015 / 14:55