Questions tagged as 'sql-server'

3
answers

Replace value null

I would like that when I came null in my select replace with 1900 , follow select: SELECT (SELECT TOP 1 tabela1.data FROM tabela1 tabela1 WHERE tabela1.id = tabela2.id) as data FROM tabela2 tabela2     
asked by 26.01.2018 / 13:06
3
answers

Get ID immediately after insertion

Use Entity and LINQ. I would like to know how I get a generated ID soon after inserting a record, before anyone else can enter it too, ie ensure that that ID is the one I generated. Has as? Use Sql Server 2008, Entity, LINQ     
asked by 26.05.2014 / 17:02
2
answers

What is the corresponding variable type of timestamp (SQL Server) in C #?

I have a field in the database (SeqAlteracao) of type timestamp and I need to map it to the C # (Entity Framework). What is the corresponding type in C # for this type in the bank? public **Tipo** SeqAlteracao { get; set; }     
asked by 21.11.2016 / 21:00
2
answers

Discovering the binary value in SQL Server

Is there a function in SQL Server that converts an integer to binary? Example: SELECT Funcao_Binario(2) -> Saida : 0010 SELECT Funcao_Binario(4) -> Saída : 0100 SELECT Funcao_Binario(5) -> Saída : 0101     
asked by 20.10.2016 / 19:58
3
answers

How to create login and user in SQL Server passing command line through Visual Studio passing parameters? [closed]

public void CriaUsuarioSystem(string userSystem, string pwSystem) { try { conexao = new SqlConnection(conexao_BD); SqlCommand creatUserSystem = new SqlCommand("CREATE LOGIN @login WITH PASSWORD = @pw " +...
asked by 09.05.2017 / 21:59
3
answers

How to tell if a key in the sql server is identity

How to tell if a key in the sql server is identity? How do I find out? The version is 2014.     
asked by 18.04.2017 / 18:56
3
answers

zero left (LPAD) on Sql Server

How to do in SqlServer so that the result comes with zero left? In mysql it would look like this: select lpad(mes,2,0 ) as 'mes', ano from tab_qualquer; How do you do something equivalent on Sql Server? I've already searched the link...
asked by 09.03.2016 / 14:16
2
answers

How to add one more condition in a query using linq?

How can I add one more condition in a join? I have the query below; var consultaVeiculo = (from e in dm.Tabela_SegVeiculos join r in dm.Tabela_VeiculoRefers on...
asked by 05.07.2016 / 21:53
2
answers

Sql Server Error 8623: The query processor ran out of internal resources and could not produce a query plan

Bank Sql Server 2012 and 2008. I have been logged into the following error (sql server 2012): error_reported 2017-12-27 09:14:16.2053050 8623 16 1 False The query processor ran out of internal resources and could not produce a quer...
asked by 28.12.2017 / 21:25
2
answers

Query returns empty using PHP with PDO and MS SQLServer

I am migrating a system made in ASP to PHP. However, I'm having trouble making a query using the PDO: Search.php class Busca extends Conexao { private $termo; public function setTermo($termo) { $this->termo = $termo; } pu...
asked by 11.11.2015 / 19:15