Viewing 15 posts - 7,771 through 7,785 (of 8,731 total)
As you're using SQL Server 2012, why won't you use TRY_CONVERT with a string Splitter[/url]?
WITH CTE AS(
SELECT TRY_CONVERT( DATETIME, Item) AS MyDate
FROM #temp t
CROSS APPLY dbo.DelimitedSplit8K( MyValues, ' ')
)
SELECT ...
August 19, 2013 at 8:59 am
You might be looking for something like this.
SELECT *
FROM( VALUES
(CAST( '20130313 12:30' AS DATETIME), 'Total Completed =4'), /*select this*/
(CAST( '20130313 12:00' AS DATETIME), 'Total Pending =5'),
(CAST( '20130313 12:00'...
August 16, 2013 at 6:25 pm
I believe that Sean, misread the queries.
The correct answer is it depends. As Ness said, Table2 might affect the results to get duplicates.
Here's an example.
DECLARE @Table1 TABLE(
col1 int,
col2 char(1))
DECLARE @Table2...
August 16, 2013 at 10:20 am
This is a weird requirement, I believe that this is a resultset and not a table as the sample data you gave us. This query might give you an idea...
August 16, 2013 at 10:15 am
Actually, is not that difficult but sometimes we get stuck on the simplest things. 🙂
Change this code as desired
DECLARE @Sort1 varchar(10)='val3'; --NOTE: @Sort2 ommitted from this example because I...
August 15, 2013 at 3:01 pm
I'm not sure what you need to do in the end, but this code should get you started and the article can help you to understand what's going on.
http://www.sqlservercentral.com/articles/comma+separated+list/71700/
WITH Parts(...
August 15, 2013 at 2:53 pm
With SQL 2012 you could use LEAD, however, you need a self join on previous versions.
WITH Sample_Data(Number) AS(
SELECT 10 UNION ALL
SELECT 20 UNION ALL
SELECT 30 UNION ALL
SELECT 40 UNION ALL
SELECT...
August 15, 2013 at 12:10 pm
With this code, you should be able to store these values in separate columns. Although, it expects to only have email and rota in the values. If something can be...
August 15, 2013 at 10:52 am
A simple JOIN should work.
DECLARE @LookUpID int
SELECT sp.SalesPersonID,
sp.FirstName,
sp.LastName,
a.Address1,
a.Address2,
...
August 15, 2013 at 9:21 am
If the table already exists, you need a different approach.
;WITH src AS
(
SELECT
database_id, db_buffer_pages = COUNT_BIG(*)
FROM sys.dm_os_buffer_descriptors
--WHERE database_id BETWEEN 5 AND 32766
GROUP BY database_id
)
INSERT INTO MyExistingTable(
...
August 15, 2013 at 9:16 am
roryp 96873 (8/14/2013)
Luis Cazares (8/14/2013)
Even better would be a decimal(8,2) 🙂
You'd get an error if you had a number that filled up that decimal(10,4) though, would you not?
123456.7890 * 100...
August 15, 2013 at 7:55 am
dwain.c (8/14/2013)
SELECT VENDOR_ID, ADDRESS_PHONE_NUM
FROM (
-- Your query (reformatted)
SELECT V.VENDOR_ID, ADDRESS_PHONE_NUM
...
August 15, 2013 at 7:51 am
I'm not sure if this will perform better, but it's another way of getting the information you need.
SELECT V.VENDOR_ID,
ADDRESS_PHONE_NUM
FROM VENDOR V
OUTER APPLY( SELECT TOP 1 ADDRESS_PHONE_NUM
FROM ADDRESS_PHONE...
August 15, 2013 at 7:49 am
Could you post the actual table definition (table and column names changed if necessary) with the clustered index and the code you're using?
August 14, 2013 at 3:42 pm
Viewing 15 posts - 7,771 through 7,785 (of 8,731 total)