Questions tagged as 'sql-server'

2
answers

How do I get the primary key identity of an inserted record?

I need to create a stored procedure to insert a game into my database. A game relates to a league through the campeonatoJogo table. The tables are basically: create table jogo( codJogo int identity primary key, nomeTime1 v...
asked by 21.11.2016 / 02:33
4
answers

How to do a "Generic Trigger" in SQL Server?

Hello, I have in my database in all tables the following fields DateTime CreatedEm | Modified DateTime I wanted to know if there is a way to do a generic trigger to control these fields, since when you enter, CriadoEm and Modif...
asked by 18.03.2014 / 17:28
3
answers

How to do an "insert" with Dapper using a class?

I'm testing Dapper and when I try to use a class I found the error:   Must declare the scalar variable Follow the code: public class Teste { public int id; public string nome; public int idade; } using (IDbConnectio...
asked by 02.10.2017 / 18:20
1
answer

Modeling with Code First so you can change databases

If I generate my database for MySQL using the concept of Code First can I change it to SQL Server in the future? Do you need to change the classes or just the config and provider ?     
asked by 17.04.2017 / 15:27
1
answer

LEFT JOIN using Linq

I have the following tables: Responsavel | Filho Id Nome | Id Nome ResponsavelId 1 Ana | 1 Aninha 1 2 Maria | 2 Ana Júlia 1 3...
asked by 04.08.2015 / 18:52
3
answers

Convert data to C #

Well folks I have a problem with my code. In my database I have a field of type date only that after calling it to the program it also passes me the time, it's something of the genre: 03-18-2015 00:00:00. What I wanted was just the part o...
asked by 18.07.2015 / 12:40
1
answer

How to create trigger for all tables in a database, automatically?

Example scenario I have a database with 1000 tables . A table named log . Objective I would like to create a default trigger on each of these tables, automatically . This trigger , whenever there is any change (inser...
asked by 05.09.2018 / 12:36
2
answers

In SQL Server how to convert string part uppercase based on the separator: \?

I need to make a script to convert all user records into a table in this format (single field): INFORMATICA\desenvolvedor ADMINISTRACAO\contador That is, before the uppercase bar and then the lower bar. How to do this in SQL Server? Cu...
asked by 17.12.2013 / 14:30
1
answer

Custom auto increment

I have to generate an auto increment of type "000"+id , but I can not get to something concrete, my base is this below, I just wanted a light how to do it, I do not need the answer itself. > @Id @GeneratedValue...
asked by 15.10.2014 / 19:09
1
answer

Import Excel to Sql Server C #

I need to import a excel file into a SQL table. However, I need to pick up the lines and go through them, since it will not be all the information I will get from excel. I have exactly what I need but get TXT file, but the informat...
asked by 05.04.2016 / 21:26