Questions tagged as 'sql-server'

1
answer

Doubt with Date formatting in sql server 2008

In my application I'm writing the dates in this format: DateTime.Now.ToString("yyyy/MM/dd"); In the database I have: 2016-01-09 00:00:00.000 Now I need to make an appointment where I will bring only the records of the day. selec...
asked by 11.01.2016 / 01:09
1
answer

Select Comparing Periods

I need to make a select that compares two sales periods, totaling by product. Today I have this select that does this, but only for a period (01/09/2014 to 09/30/2014) SELECT ACC.PRODUTODESC PRODUTO, Sum(ACC.VALORTARIFA)...
asked by 05.02.2016 / 15:03
1
answer

Intermediate table of relationship n for n [closed]

I have two tables with N to N in my database, so I should create an intermediate table that has the PK of each of those two tables. My question is: how to enter data by correctly referencing the PKs in the middle table?     
asked by 26.10.2015 / 17:50
2
answers

Is it possible to know where a sql execution originated from SQL SERVER?

There is a situation that I believe will be of great importance to me, which is to know the origin of a sql command in SQL SERVER. Suppose that a user accidentally ran any command. So I need to know who ran the command. Is there any way to...
asked by 16.02.2016 / 17:27
1
answer

How to delimit a txt file, that is, the line length should be 700 characters for all subsequent lines

I created a routine that reads some tables and generates rows as read. At first this is all right. but the txt generated exceeds the size of the fields, for example, one field has size 10 and another size 20 and another 15, the total would be 45...
asked by 14.01.2016 / 17:23
2
answers

Job created in SSIS does not work in SQL SERVER AGENT

I have a job created in SSIS (working perfectly) that does not work in SQL SERVER AGENT. The job extracts some data from an access table, via ODBC, and loads into a sql server local table. The Sql Server and the access database are on different...
asked by 14.01.2016 / 17:03
1
answer

Data format php pdo [duplicate]

Input: <html> <form action="../controller/progPrecontrole.php" method="POST" onsubmit="return valid();"> <input type="hidden" name="id" value="<?php echo $id; ?>"/> <p>Data Saída:</p> <input...
asked by 18.01.2016 / 20:15
1
answer

What is the difference between OUTER APPLY and INNER JOIN on Sql Server?

What is the difference between OUTER APPLY and INNER JOIN in Sql Server ? I know how LEFT/RIGHT/INNER JOIN works however I came across OUTER APPLY I gave a read but I did not completely understand, it seems t...
asked by 22.09.2015 / 01:23
1
answer

Get the parent passing the child code using Hierarchical Data (SQL Server)

How do I get EmployeeID of the parent passing the EmployeeID of the child from the table below using the hierarchyid variable in SQL Server? CREATE TABLE Employee ( Node hierarchyid PRIMARY KEY CLUSTERED,...
asked by 26.08.2015 / 22:21
1
answer

Show only one record of each ID

I have a table Clientes and a ClientesTel . I need to present a list where Código do Cliente, Nome, Telefone e o email appears, but by structure I can have several phones. Here's the SQL I'm trying to modify: SELECT Cliente...
asked by 05.09.2015 / 06:34