When using this statement I get the following error: Cannot insert an explicit value into a timestamp column. Use INSERT with a column list to exclude the timestamp column, or insert a DEFAULT into the timestamp column How do I insert the current time to a timestamp column? Answer According to MSDN, timestamp…
script issue Transact-SQL
I Want to return All table names from a use data base but this just return a char the output is s s s s s s Answer You need to define the length of @tableName, by default it is set to 1 character.
SQL Server Convert Varchar to Datetime
I have this date format: 2011-09-28 18:01:00 (in varchar), and I want to convert it to datetime changing to this format 28-09-2011 18:01:00. How can I do it? Answer
How to create a sql view (CREATE VIEW) in sqlite(android) and query?
So I have a table and I want to create another table using “CREATE VIEW” from sql. I need to make a copy of the table that I am working with so I can use it 2x. My sql query would have to be like this: my initial table is: so anyone has any ideea where (in my code) I
How to sum Accounts
I have 3 tables: DimAccounts, DimTime and FactBudget. DimAccounts example: DimTime example: FactBudget example: In FactBudget are many Accounts just with type B. I need to calculate Debit and Credit Sums where Account type is S (Sum). Columns AccountFrom and AccountTo shows B Type Accounts from where to begin…
Stored Procedures vs Code in Database Query
What are the performance differences between accessing a database to query using ASP.NET Code behind against using SQL Stored Procedure For ease of use, coding the query is easier, especially when …
How to retrieve the current value of an oracle sequence without increment it?
Is there an SQL instruction to retrieve the value of a sequence that does not increment it. Thanks. EDIT AND CONCLUSION As stated by Justin Cave It’s not useful to try to “save” sequence number so is good enough to check a sequence value. I still keep Ollie answer as the good one because it …
Use one CTE many times
I have this, and i get an error at set total. Why can’t i access a cte many times? ALTER PROCEDURE [dbo].[GetLeaguePlayers] ( @idleague int, @pageNumber int, @pageSize int, @total int …
How to test linkedserver’s connectivity in TSQL
I need to write a procedure to collect data from several remote servers, I use linkedservers and OPENQUERY to gather data from servers, but sometimes I lose connection to some servers or I simply can’t connect them (e.g. remote server is offline)- and OPENQUERY results in time-outs in these cases. So I …
sql runs fast in ssms slow in asp.net
I have been having this problem for a couple of weeks now. The problem is that the query takes 4-5 minutes to run on the website and at most 2 or 3 seconds to run in ssms. Also I found that after I make a change to this query like adding the customerId variable it will start running quickly on