Questions tagged as 'sql-server'

1
answer

How to use a variable across the scope of SQL batch

With the batch below, I want to remove the duplicate records and then perform an UPDATE on some values. The querys are in perfect order, but adding some error checks for the process execution, I came across the following error:    Must declar...
asked by 01.02.2016 / 20:01
1
answer

How to change a SQL Server View

I have some Views on SQl Server that have been implemented by other people, but they have not left any documentation and scripts, I believe it is possible to access to change and maintain them? But I do not know how to do that. Note: The view wi...
asked by 29.07.2015 / 16:02
2
answers

Get start date and end date of a week of the month

Good afternoon, guys. Today I have a problem getting the start date and end date for a week of the month. Let's break it down: I have a combo that brings me the weeks of a month posted. To know how many weeks I have in January 2015, for ex...
asked by 20.07.2015 / 20:14
2
answers

Return columns that accept boolean in a table

I need a query that brings the names of the columns in a table that accept boolean . Ex: In the clientes table, I have the fields casapropria (1 for yes, 0 for no), temfilhos (1 for yes, 0 for no).     
asked by 16.07.2015 / 16:13
1
answer

How to sort sql columns in alter table

I have a change to make in the table Inclusão de colunas the doubt is how do I set the order when I am making the change in sql server 2008? ALTER TABLE dbo.Arquivos ADD IdTipoDocumento int NULL, -- order 3 NomeInterno nvarchar(200...
asked by 12.11.2015 / 13:20
1
answer

How to execute a query with large data volume?

Is there any way to run a file with a large volume of data without being direct in SQL Server 2014 Management Studio , as I try to open to execute and get the following error:    Can not run script. Insufficient memory to continue   imp...
asked by 09.11.2015 / 18:58
1
answer

How to create schema and use it in table creation

I need to create tables, but have this structure. For the tables of Cadasters I put: Registration.Company, Registration.UF, Registration.Address and so on. For the Logo tables I do: Log.Access, Log.Errors For the Domain tables I would have Do...
asked by 13.05.2015 / 18:15
1
answer

Add column as Primary Key

I ran the following script: CREATE TABLE [dbo].[horario]( [Ano] [int] NOT NULL, [CodigoTurma] [varchar](5) NOT NULL, [Ordem] [int] NOT NULL, [Professor_Id] [int] NOT NULL, [Matriz_Semestre] [int] NOT NULL, [Matriz_Curso...
asked by 09.06.2015 / 05:37
1
answer

A cursor within another sqlserver cursor

I know I could do a join of tab1 with tab2, but that would not be the case, I need the two cursors. When I run I get the error: A cursor with the name 'cursor_tab2 ' already exists. The cursor is already open. I even understand the erro...
asked by 07.05.2015 / 19:48
1
answer

Displaying Results other than one column [closed]

I have a CAIXA table, where TIPO can have two results, 00 and 99 , where 00 is the opening of the terminal and 99 the closing. > I'm trying to create a query where the result is to show me only the bran...
asked by 27.08.2016 / 15:58