In SQL Server 2008 I have a table called Zone with a column ZoneReference varchar(50) not null as the primary key. If I run the following query: select ‘”‘ + ZoneReference + ‘”‘ as …
Tag: sql-server
What is the keyboard method for filtering in SQL Management Studio?
I make very heavy use of filtering in SQL Server Management Studio when working with a large number of stored procedures – but find it a slow process as I have to right click, move my mouse to select ‘filter’, type in filter, and then click OK. Is there hotkey to pull up the filter dialog when I have the
using DateDiff to find duration in minutes
I am trying to use Datediff to find out the duration between columnA and columnB. This produces errors. Can anyone please help me with what I’m doing wrong? Answer how about trying this, not sure why you have stime = [exceptions2].starttime and etime = [exceptions2].endtime
sql query: return a list that will contain the users / groups who will have access to an application
I’m doing an sql query where I want to return a list that will contain the users / groups who will have access to an application. This is the scheme, we will see if a user have permissions, if not, we …
SqlBulkCopy from a List
How can I make a big insertion with SqlBulkCopy from a List of simple object ? Do I implement my custom IDataReader ?
The parameterized query expects the parameter which was not supplied
I’m having a problem with my code: Once I typed in the string in the textbox to search for an item I get this error: The parameterized query ‘(@Parameter1 nvarchar(4000))SELECT * FROM borrow where (Departme’ expects the parameter ‘@Parameter1’, which was not supplied. Can anyone help me? Answer If you pass null value to parameter,you will get this error even
Getting result of dynamic SQL into a variable for sql-server
Executing dynamic SQL as follows in Stored Procedure: How do I use the count(*) column value as return value in the SP? Answer
COUNT results from SQL Query with a HAVING clause
Are you able to use COUNT in a query with a HAVING clause so that the COUNT returns the number of rows? When I try, Im getting the count of the number of times the ID shows up in the table. Here is …
Get the 2 digit year in T-SQL
I need to get the current 2 digit year and increment by one. So the current number I’m looking for should be 11. Probably really simple but I’m a sql noob 🙂 Thanks Answer You can do ( YEAR( GETDATE() ) % 100 ) + 1 See GETDATE & YEAR
Should every SQL Server foreign key have a matching index? [closed]
Closed. This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 7 months ago. The community reviewed whether to reopen this question 7 months ago and left it closed: Original close reason(s) were not resolved Improve this question