Questions tagged as 'sql-server'

4
answers

How to retrieve a value from within a tag in XML?

I have a table called SPDNFE with a column DsXML that contains all contents of a Xml . Query: SELECT top 1 SPDNFE.DsXML FROM SPDNFE where SPDNFE.CdIdNFe = 'NFe32170710490181000569550040001475221002513963' Return of...
asked by 07.08.2017 / 16:42
1
answer

How to evaluate which command to use between truncate / delete

I was reading about these commands Truncate table and Delete from , where I saw this explanation    Truncate table - This command removes the watermark from the wiping table   the same for next use.       Delete from - But t...
asked by 26.09.2017 / 21:54
2
answers

How to display the total rows of a table in a label

I do not know how to pull the total rows of a table, code: public string Eventos { get; set; } SqlCommand comando = new SqlCommand("SELECT count(*) FROM Active", conn); SqlDataReader leitor = comando.ExecuteReader(); while (leitor.Read()) {...
asked by 26.09.2017 / 18:08
2
answers

Inserting 1000 records into table with uniqueidentifier as primary key

I have to add, 1000 records in a given table. It contains the field Name . I have the Script, which does the bulk insertion. However, the primary key of this table is uniqueidentifier ( Guid() ) how I can do this using th...
asked by 16.02.2017 / 12:54
1
answer

How to treat in C # data coming from a table that is of type bit in sql server?

In Visual Studio it will look like this: alerta.DataHoraCadastro = dr.Get(12); How do I do this?     
asked by 01.12.2016 / 20:03
1
answer

Difference between SQL Server Express versions?

What is the difference between DreamSpark SQL Server Express versions?     
asked by 04.12.2015 / 23:34
2
answers

Limit occurrences of records for each type

I need to limit the number of occurrences of each type of material I have in my database. Follow the query below with what I want to do: SELECT TOP 10 ID, NOME, TIPO FROM TB_MATERIAIS WHERE TIPO = 1 SELECT TOP 10 ID, NOME, TIPO FROM TB_MATE...
asked by 16.11.2016 / 14:55
2
answers

What is position in SQLServer?

I have a question. I received the layout of a table which consists of: Nome do campo | Tamanho | Posição | Tipo The Position contains: De | Até And one of the fields is: Histórico ( no caso da Posição ): 35 | 104 What exactly is...
asked by 15.10.2015 / 17:12
1
answer

Why is it mandatory to use the ';' in the WITH clause?

I've always used WITH in my queries, however, I've never understood exactly why '; ' before the WITH clause is required. The error is very succinct, but gives an idea that WITH requires the previous statement to be clos...
asked by 27.10.2017 / 14:11
1
answer

How to convert date to datetime?

I have the following case, I'm trying to convert a date field to datetime using update update tb_RHContratos set DtCadastro = cast(DtCadastro as datetime) But some of the date does not format correctly as they are too many r...
asked by 06.11.2015 / 19:20