Questions tagged as 'sql-server'

5
answers

How to check if a text or ntext field is null or empty?

How can I check if a field of type ntext is null or empty in where ? I have the following select SELECT Subject, Notes from DocumentNotes where Notes is null or Notes = ' ' but when compared it returns the following error...
asked by 19.11.2015 / 15:08
1
answer

INNER JOIN with 3 tables

I have 3 tables TB_ContratoCotista: TB_Contract: TB_Cotist: I would like to relate the values of the TB_Contract table with TB_Cotist but the way I got it just returns the result of the TB_Contract . What am I missin...
asked by 03.07.2015 / 19:25
3
answers

Error in a simple SELECT with Group By - SQL Server

I'm trying to do the following SELECT: SELECT P.Nome,P.TipoId,P.QuantidadeMensal FROM StockPhotos.Pacote P GROUP BY P.QuantidadeMensal; However, I'm getting this error message:    Message 8120, Level 16, State 1, Line 2       Co...
asked by 06.08.2018 / 21:39
3
answers

Transform rows into columns with their respective values

I have the following table idRegistro|Campo |Valor 1 |Nome |Zonaro 1 |Email |[email protected] 1 |campoX|valorX 2 |Nome |Fulano 2 |tel |1188889999 2 |campoY|valorY I need to create a sele...
asked by 17.02.2016 / 14:41
3
answers

Select Active Lot

I am studying about queries in SQLServer and I have the following scenario: I have a batch table that has the following fields: Lot Table Id INT ProdutoID INT Preco SMALLMONEY Inicio DATETIME Fim DATETIME Product Table (Produc...
asked by 16.08.2017 / 00:15
2
answers

Login with Windows Authentication in IIS

I have a SqlServer 2008 base where all users can connect to it via Windows domain, this works correctly via SQL Management Studio. I'm doing a C # Application in MVC, and wanted it when the user accessed the site, I could get that login and p...
asked by 03.05.2016 / 14:17
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
1
answer

Is it possible to generate a script from a table, from an SQL command?

I would like to generate a script to create a table, from a SQL command so I could build a program that would be able to clone tables. I'm using SQL Server 2008 R2 and need to implement a table cloning routine, within an application written i...
asked by 13.10.2014 / 14:42
3
answers

The null value automatically changes to 0

I'm doing a vehicle registration, I need it to register that whenever a vehicle is registered to zero instead of the value null, I tried by default, but it does not record the information. I'm using SQL Server along with C # in visual studio....
asked by 28.08.2017 / 20:00
3
answers

Is it possible to back up a remote bd sql server via C #?

I am using the Microsoft.SqlServer.Management.Smo assembly to back up a Sql Server database in C #. The problem is that in the way it is implemented I can only perform the action if I am running the application on the same database server. Wo...
asked by 14.04.2015 / 14:41