When I add a new record I want SQL Server to automatically add a fresh ID. There are already some records which have been migrated over (from Access) and until I finish preparing the server for other required functionality I will be manually migrating further records over (if this affects any possible answers). What are the simplest ways to implement
Tag: sql-server
SQL performance MAX()
Just got a small question. When trying to get a single max-Value of a table. Which one is better? or I’m using Microsoft SQL Server 2012 Answer There will be no difference as you can test yourself by inspecting the execution plans. If id is the clustered index, you should see an ordered clustered index scan; if it is not
SQL Server 2008 – Email notifications
I have a SQL server / database locally and accessed through ip etc… What I want to know is how to send emails directly from the server (when n happens)? Answer You can use Database Mail. To send e-mails via SQL Server you can use the following stored procedure: sp_send_dbmail Or how to configure a SQL agent to send mail
Parse SQL Server Data
I used SSIS and [SharePointListAdapters][1] [1]: http://sqlsrvintegrationsrv.codeplex.com/releases to import data from my SharePoint 2010 list and put it into SQL Server 2008 table. TThere are roughly 500 rows of data. Now the challenge is to parse data appropriately. I have a couple of columns that have html tags around them. For e.g., Column Project Desc has data like Project Desc
SQL count(*) performance
I have a SQL table BookChapters with over 20 millions rows. It has a clustered primary key (bookChapterID) and doesn’t have any other keys or indexes. It takes miliseconds to run the following query However, it takes over 10 minutes when I change it like so or Why is that? How can I get select count(*) to execute faster? Answer
SQL server 2012 SP_HELPTEXT extra lines issue
I am using SQL server 2012, & always use SP_HELPTEXT to get my previously created Stored Procedures, In previous versions of SQL server there were no issues in this process but in 2012, My Stored Procedures come with extra lines, for example this is the procedure that I wrote Now after using SP_HELPTEXT with this procedure (or any other procedure),
Delete statement in SQL is very slow
I have statements like this that are timing out: I tried doing one at a time like this: and so far it’s at 22 minutes and still going. The table has 260,000 rows in it and is four columns. Does anyone have any ideas why this would be so slow and how to speed it up? I do have a
Duplicate Rows on SQL Join
When I do a left join on a table it duplicates the results from the left table when more values are found in the right table. How can I only return the distinct values from the left even when there are multiple values on the right table. (return only the one movie even when there are multiple images on the
SQL Server: backup all databases
I was wondering if there was any way of making a backup of an entire SQL Server (we are using SQL Server 2008) at regular intervals to a specific location. I know we are able to backup single specific databases but for ease of use and not having to set up a backup each time I want a new database,
How do I query for all dates greater than a certain date in SQL Server?
I’m trying: A.Date looks like: 2010-03-04 00:00:00.000 However, this is not working. Can anyone provide a reference for why? Answer In your query, 2010-4-01 is treated as a mathematical expression, so in essence it read (2010 minus 4 minus 1 is 2005 Converting it to a proper datetime, and using single quotes will fix this issue.) Technically, the parser might