tagged [sql]
The variable name '@' has already been declared. Variable names must be unique within a query batch or stored procedure
The variable name '@' has already been declared. Variable names must be unique within a query batch or stored procedure > The variable name '@LockState' has already been declared. Variable names must ...
- Modified
- 18 Jan at 16:57
Is there an Entity Framework 7 Database-First POCO Generator?
Is there an Entity Framework 7 Database-First POCO Generator? I've been playing around with Entity Framework 7 and ASP.NET 5 for a new project I'm working on, but I've hit a roadblock. The team I'm wo...
- Modified
- 10 Jan at 04:50
updating table rows in postgres using subquery
updating table rows in postgres using subquery I have this table in a postgres 8.4 database: I want to update the table. Initially i tested my q
- Modified
- 10 Jan at 00:29
Function vs. Stored Procedure in SQL Server
Function vs. Stored Procedure in SQL Server When should I use a function rather than a stored procedure in SQL, and vice versa? What is the purpose of each?
- Modified
- 9 Jan at 23:52
Retrieving the date in SQL Server; CURRENT_TIMESTAMP vs GetDate()
Retrieving the date in SQL Server; CURRENT_TIMESTAMP vs GetDate() Using SQL Server, which is the fastest or best practice method to use for date retrieval? Is there a difference between `CURRENT_TIMES...
- Modified
- 6 Jan at 15:22
How to log PostgreSQL queries?
How to log PostgreSQL queries? How to enable logging of all SQL executed by PostgreSQL 8.3? I changed these lines : And restart PostgreSQL service... but no log was created... I'm using Windows Server...
- Modified
- 6 Jan at 13:9
How to skip certain database tables with mysqldump?
How to skip certain database tables with mysqldump? Is there a way to restrict certain tables from the mysqldump command? For example, I'd use the following syntax to dump `table1` and `table2`: But i...
Check if a row exists, otherwise insert
Check if a row exists, otherwise insert I need to write a T-SQL stored procedure that updates a row in a table. If the row doesn't exist, insert it. All this steps wrapped by a transaction. This is fo...
- Modified
- 29 Dec at 01:2
Reset auto increment counter in postgres
Reset auto increment counter in postgres I would like to force the auto increment field of a table to some value, I tried with this: AND I have a table `product` with `Id` and `name` field
- Modified
- 29 Dec at 00:48
SQL Query slow in .NET application but instantaneous in SQL Server Management Studio
SQL Query slow in .NET application but instantaneous in SQL Server Management Studio Here is the SQL ``` SELECT tal.TrustAccountValue FROM TrustAccountLog AS tal INNER JOIN TrustAccount ta ON ta.Trust...
- Modified
- 27 Dec at 23:24
Save byte[] into a SQL Server database from C#
Save byte[] into a SQL Server database from C# How can I save a byte[] array into a SQL Server database? This byte[] contains a HashAlgorithm value. The data is needed again for later use. So converti...
- Modified
- 27 Dec at 01:52
Why would reusing a DataContext have a negative performance impact?
Why would reusing a DataContext have a negative performance impact? After a [fair](https://learn.microsoft.com/en-us/archive/blogs/dsimmons/context-lifetimes-dispose-or-reuse) [amount](https://weblog....
- Modified
- 24 Dec at 11:5
MSSQL Select statement with incremental integer column... not from a table
MSSQL Select statement with incremental integer column... not from a table I need, if possible, a t-sql query that, returning the values from an arbitrary table, also returns a incremental integer col...
- Modified
- 22 Dec at 05:2
SQL: how to select a single id ("row") that meets multiple criteria from a single column
SQL: how to select a single id ("row") that meets multiple criteria from a single column I have a very narrow table: user_id, ancestry. The user_id column is self explanatory. The ancestry column cont...
SQL Server 2008 - Help writing simple INSERT Trigger
SQL Server 2008 - Help writing simple INSERT Trigger This is with Microsoft SQL Server 2008. I've got 2 tables, Employee and EmployeeResult and I'm trying to write a simple INSERT trigger on EmployeeR...
- Modified
- 22 Dec at 01:4
How to use If Statement in Where Clause in SQL?
How to use If Statement in Where Clause in SQL? I need to use if statement inside where clause in sql. ``` Select * from Customer WHERE (I.IsClose=@ISClose OR @ISClose is NULL) AND (C.FirstName lik...
- Modified
- 21 Dec at 22:12
How to use multiple conditions (With AND) in IIF expressions in ssrs
How to use multiple conditions (With AND) in IIF expressions in ssrs I want to hide rows in SSRS report having Zero Quantity. There are following multiple Quantity Columns like Opening Stock, Gross Di...
- Modified
- 21 Dec at 21:36
Creating a custom query with Spring DATA JPA?
Creating a custom query with Spring DATA JPA? I'm working on a project with Spring Data JPA. I have a table in the database as my_query. I want to create a method which takes a string as a parameter, ...
- Modified
- 21 Dec at 21:33
Stored procedure with default parameters
Stored procedure with default parameters I am trying to create a stored procedure based on a query I wrote with parameters that are predefined. When restructuring to a create stored procedure and I ex...
- Modified
- 21 Dec at 04:55
How can I tell if a VARCHAR variable contains a substring?
How can I tell if a VARCHAR variable contains a substring? I thought it was `CONTAINS`, but that's not working for me. I'm looking to do this: I have to run one `select` or another, depending on wheth...
- Modified
- 21 Dec at 04:50
Filter df when values matches part of a string in pyspark
Filter df when values matches part of a string in pyspark I have a large `pyspark.sql.dataframe.DataFrame` and I want to keep (so `filter`) all rows where the URL saved in the `location` column contai...
- Modified
- 21 Dec at 04:29
GROUP BY having MAX date
GROUP BY having MAX date I have problem when executing this code: Basically, I want to return the most recent date for each control number. The query above returns correct output but it takes 37secs. ...
- Modified
- 20 Dec at 00:51
MySQL Sum() multiple columns
MySQL Sum() multiple columns I have a table of student scorecard. here is the table, Now, I need to sum it for each student of total marks. I got it by using `sum(mark1+mark2+...+markn) group by
Add column to SQL Server
Add column to SQL Server I need to add a column to my SQL Server table. Is it possible to do so without losing the data, I already have?
- Modified
- 19 Dec at 09:45
Update one MySQL table with values from another
Update one MySQL table with values from another I'm trying to update one MySQL table based on information from another. My `original` table looks like: And the `tobeupdated` table looks like: ``` uniq...