I would like to check if the trigger exists on [tbl] and create another one. I tried it this way but didn’t work. What am I doing wrong? Answer The [name] field in sys.objects will contain only the actual name (i.e. trg), not including the schema (i.e. dbo in this case) or any text qualifiers (i.e. [ and ] in
Tag: sql-server-2008
A constant expression was encountered in the ORDER BY list
Below is my dynamic query and it’s not working. It threw: A constant expression was encountered in the ORDER BY list, position 2. Original dynamic query: Extracted Query: If I remove second order by line, CASE WHEN ‘ItemDescription’=’ItemDescription’ AND ‘0’= ‘1’ THEN cteForPriceVen.ItemDescription END DESC the query seems working. Answer The second line: Is equivalent to NULL. You can’t order
How to declare sql variable in C#
My requirement is to remove all record but one from a table. For this I am executing a series of two different sql commands. Seems like on ssms it works fine but with C# is not –This is what I run …
How to get last date of month SQL Server 2008
I created a function “ufngetFirstDateOfMonth” and “ufngetLastDateOfMonth” stored in Microsoft SQL Server 2008. My purpose is to send some date into the function and it will return the first date of …
Incorrect syntax near the keyword ‘Table’ C# SQL [closed]
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers. Want to improve this question? Update the question so it’s on-topic for Stack Overflow. Closed 7 years ago. Improve this question Hello I’m trying to figure out why i have this error Incorrect syntax near the keyword ‘Table’. Thx in advance Code :
Default row order in SELECT query – SQL Server 2008 vs SQL 2012
Our team recently upgraded our databases from SQL Server 2008 to SQL Server 2012. One breaking change we noticed was in the default order of rows returned by the SELECT statement, i.e. when an explicit ORDER BY clause is not specified. As per MSDN, SQL Server 2012 does not gaurantee the order of the rows returned unless an ORDER BY
SQL Server 2008 R2 Stuck in Single User Mode
Having executed a DB deploy (from a VS SQL Server database project) on a local database, which failed, the database has been left in a state where it has single user mode left on (the deploy runs as …
convert datetime (mm/dd/YYYY) to decimal(YYYYmmDD)
I am trying to get the following result in Sql: example: 23/05/2014 to 20142305 but get this: result:41780 anyone know how you can get the following format?? (if possible ??) regards and thanks Answer In many databases (including SQL Server), you can just do: Some databases don’t support these functions, so you might need extract(datepart from datetime) or a similar
Set column to a concatenated value from another table
I have 2 tables in SQL Server 2008: Address: nameid | e-mail ————— 1 | xyz@abc.com 2 | fgh@asdf.com 3 | 123@doremi.com Member: nameid | memberid ————— 1 | …
How to fill missing dates and values in partitioned data?
How to fill missing dates and values in partitioned data? I’m having a lot of trouble Googling this as most of the posts seem to feature Oracle databases, and I’m working with Microsoft SQL Server. I have the following hypothetical table: I want to fill in the dates in between the gaps and copy over the value from the most