Questions tagged as 'sql-server'

3
answers

How to use the result of a select to mount another?

I've mounted a select that concatenates a String. I want to use the result of this select in another select SELECT * FROM (SELECT CONCAT('caminho da tabela') AS caminho FROM tabela) AS result Can you do it? How can I use it?     
asked by 06.01.2016 / 16:31
1
answer

Generate database backup

In my project, I have a database that has a lot of registry. So I wanted SQL Server to do a backup a day or a week. But I think the per day is better. But how can I make this script to be scheduled in SQL Server and it does the scheduled...
asked by 27.11.2014 / 13:23
5
answers

How to erase data from a table with dependencies in other tables

I need to delete data from a table that has dependencies on other tables. For example so that I can delete a data from the person table first I have to delete a dependency that exists in the credential table which in turn has dependency on anoth...
asked by 29.09.2014 / 23:41
3
answers

Changing the data type of a sql column

Good morning. I have the CliTelCel char(10) column in the Clientes table, I need to change char(10) to char(11) . But this column already exists data, what would be the best way to proceed in this case, without losi...
asked by 18.05.2017 / 14:47
3
answers

Should log tables have Foreign Keys?

I had a case in my service on those days when it was not possible to delete a record because it was referenced by the log table. Of course, that has generated a call for IT to solve. But such a case made me think. Although by default I...
asked by 12.08.2016 / 17:03
5
answers

Separate ddd from phone with SQL statement

I have a table with DDD and Phone fields. Some have been registered correctly, others ddd is next to the phone and I need to separate. TABLE +--------------------+ | DDD | Telefone | +--------------------+ | 47 | 89876543...
asked by 10.12.2015 / 16:29
2
answers

Full Join N-N without repeating records

I have two tables with relation N-N: ITEM_ORC ITEM_COMP | OP | Item Orçado | | OP | NF | Item Comprado | +-------+------------------+ +-------+---------+------------------+ | 1...
asked by 23.04.2015 / 15:03
2
answers

How to construct a complete XML in T-SQL?

I'm working on a procedure that returns a field in XML, so far nothing bad. The problem arises when I have initial data coming from a query and intermediate data coming from another query. I tried to solve with string concatenation and then c...
asked by 28.02.2014 / 16:40
1
answer

What is the difference between ASC or DESC in clustered indexes?

When I am going to create a non clustered index in SQL SERVER, SSMS appears in the option to choose whether the option "Columns" is ASC or DESC , as shown below: / p> Generally, I use ASC or DESC to sort the...
asked by 30.08.2018 / 19:23
3
answers

What is the most correct way to query with LINQ?

I'm trying to make a LINQ query on my DB SQL Server, but its result always comes 'null'. I need the first userid on which I query. This is the way I try to query it: public decimal GetCustomerBalance(long accountCurrentAdvisorId) {...
asked by 11.04.2015 / 05:46