Viewing 15 posts - 4,966 through 4,980 (of 10,144 total)
Table sales_month doesn't contain year. Start with something like this:
SELECT s.*, c.*
FROM Sales_Month s
INNER JOIN view1 c ON c.? = s.Month_Number
WHERE c.[year] = ?
Replace the question marks with something...
March 26, 2013 at 7:27 am
winmansoft (3/26/2013)
I am using Sql server 2008 R2 express.I want a column id with auto incrementing value in my table.But i don't want to use built in Auto increment property...
March 26, 2013 at 7:12 am
select top 5 machine.name, machine.model, machine.scantime
'INSERT INTO [SMS_000].[dbo].[BMCMachines] ([ComputerName],[MachineModel],[stime]) VALUES (' + '''' + machine.name + ''',' + '''' + machine.model + ''',' + convert(datetime,machine.scantime,112) + ''')' from...
March 26, 2013 at 6:58 am
Steve JP (3/26/2013)
...The issue with the convert is that the 3rd arguement is the style and is used to set the style when you convert from a datetime to a...
March 26, 2013 at 6:52 am
astrid 69000 (3/26/2013)
March 26, 2013 at 6:00 am
abitguru (3/26/2013)
GilaMonster (3/26/2013)
abitguru (3/26/2013)
SELECT * FROM Reque_pa WITH (UPDLOCK) WHERE EMPRE=1 AND CEREQ = 1UPDATE Reque_pa SET Proximo=107918, Pendiente=0 WHERE EMPRE=1 AND CEREQ=1
You're selecting, then updating the table with...
March 26, 2013 at 5:33 am
You will need to apply similar logic to all tables which have duplicate rows per employeeid. I'd guess that you need the most recent rows containing org.ORGANIZATIONID and job.JOBTITLEID. Can...
March 26, 2013 at 5:21 am
Astrid, please look very carefully at the results of Kingston's solution and mine. They look the same but they are not. One of them will be correct (probably!), the other...
March 26, 2013 at 4:41 am
Is this what you're looking for?
DROP TABLE #SampleData
;WITH SampleData AS (
SELECT *
FROM (VALUES ('A',1), ('B',2), ('C',3), ('D',4), ('E',5), ('F',6)) d ([SomeStuff], [OrderlineID])
)
SELECT *
INTO #SampleData
FROM SampleData
-- check
SELECT * FROM...
March 26, 2013 at 4:36 am
tmac25 (3/26/2013)
This is really odd, Chris. ...And so... Any ideas?
Yes - one or both of the other two tables has multiple rows per employee. Can you check both tables to...
March 26, 2013 at 4:04 am
-- Create a sample data set to work with
-- A #temporary table called #AstridsSampleData
IF object_id('TempDB..#AstridsSampleData') IS NOT NULL
DROP TABLE #AstridsSampleData
;WITH CTE_SomeStuffIMadeUp ([day], [Count]) AS (
SELECT '2008-01-01 00:00:00.000', 3 UNION...
March 26, 2013 at 3:59 am
Run this, post the first ten or so rows returned:
SELECT rn = ROW_NUMBER() OVER(PARTITION BY employeeid ORDER BY ACTIONORDER DESC),
employeeid,
FIRSTNAME,
LASTNAME,
EMAILADDRESS,
STARTDATE,
ACTIONORDER
FROM linkedServer.linkedDB.dbo.AUEMPLOYEE as employee
WHERE employee.ENDDATE IS...
March 26, 2013 at 3:43 am
astrid 69000 (3/26/2013)
the query...
March 26, 2013 at 3:39 am
D'Oh!
;WITH Employees AS (
SELECT rn = ROW_NUMBER() OVER(PARTITION BY employeeid ORDER BY ACTIONDATE DESC),
employeeid,
FIRSTNAME,
LASTNAME,
EMAILADDRESS,
STARTDATE
FROM linkedServer.linkedDB.dbo.AUEMPLOYEE
WHERE employee.ENDDATE IS NULL -- still active
)
SELECT
e.*,
org.ORGANIZATIONID,
job.JOBTITLEID
FROM...
March 26, 2013 at 3:01 am
Viewing 15 posts - 4,966 through 4,980 (of 10,144 total)