Questions tagged as 'tsql'

2
answers

SQL Server 2005 and row versioning

In my current scenario, every Friday, I need to list all rows in a table that have been added or changed. In this table we have a DataDeInclusao field that obviously receives the date of inclusion of that record. My problem is to li...
asked by 16.04.2014 / 16:04
1
answer

SQL Server Data Dictionary

Hello, I come from the Oracle culture and I want to learn a little bit of SQL Server, I'm having trouble finding the SQL Server data dictionary, I've already looked at other forums and found nothing. In Oracle we have a data dictionary that s...
asked by 20.05.2018 / 01:58
3
answers

Change column for indentity using T-SQL in SQL Server

I need to change an existing column in a table so that it has the identity property using T-SQL and then insert data into this table. The column already contains data and after this insertion, I must again change this column by disabling...
asked by 15.12.2015 / 15:35
2
answers

How to get the size of each table in the database?

By query , how can I get the disk space that the tables (in a database) are occupying? I can list all tables using sys.tables , but what about size? SELECT NAME AS NomeTabela FROM sys.tables     
asked by 13.04.2017 / 02:27
4
answers

SQL Home Time (Years, months and days) [duplicate]

I need to create a function in SQL that returns employee's time, for example: years , months and days So far I've been able to bring the years and months , but I could not reach the day's logic yet, / p> DECLARE @DTINI DATE, @DTFI...
asked by 30.12.2015 / 12:58
5
answers

How to get the total character size of an SQL column?

I want to get the total length of characters that a column supports, eg INT supports 10 characters. I tried to use DATALENGTH that does not return the number of characters , but the amount of bytes that the column occupies....
asked by 10.04.2014 / 20:39
3
answers

How to insert an extended value into a table in a column of type varbinary?

A table has a varbinary (max) column, I need it to have an entry with 400MB of data in this column. How do I create this data? Does the Insert statement have to have the data in full or can I use a loop or a function that manages this data...
asked by 12.12.2013 / 13:09
3
answers

Query on sql query

I have a question. I think it's not very complex, but I could not solve it. For example, I have this query: select * from Paciente where ClinicaID = 3 Your result would be these 3 records: NomePaciente HoraAtendimento Ativo Clinica...
asked by 28.11.2017 / 23:55
2
answers

Simple SQL Query

I have a proc that gets the ID of a product. If it gets NULL, then it should list all products. If you get the specific ID, you should only list that product. Is there any way to do this without having to create a dynamic query?     
asked by 06.11.2015 / 14:16
1
answer

Enter X number of characters in SQL Server field

Hello, I have two banks BDMCOM1 and BDMCOM1_V3_ALEA, both of which have a table named ProductDrive and the field called CodigoProduct, in the database table BDMCOM1, theProductDocument has 5 digits, in the table of the other bank theProductDocume...
asked by 07.07.2016 / 21:40