Viewing 15 posts - 376 through 390 (of 394 total)
There's no subquery there. Have you got any triggers on the table?
The normal cause of this error is a subquery returning > 1 value, which is of course invalid...
July 30, 2012 at 4:18 am
It's scoped to the session, so it's dropped when the proc terminates.
July 27, 2012 at 9:05 am
What's the problem exactly? REPLACE() will replace any number of occurrences in a string.
July 27, 2012 at 2:56 am
Oops... make that '2012 Jul 18 23:59:59:997'!
BTW DateTime is only accurate to 3 milliseconds.
July 26, 2012 at 7:36 am
Wildcards only work on character fields.
To get all records for a date you can do this:
select * from mytable where UploadDate BETWEEN '2012 July 18' AND '2012 July 19'
or you...
July 26, 2012 at 7:34 am
SQL will not set multiple values to a variable like that.
It effectively gets set 3 times, once for each row, overwriting the previous.
You need to concatenate the values yourself in...
July 26, 2012 at 7:06 am
Post the query so people can have a look at it:-)
July 26, 2012 at 5:58 am
How about this: I haven't tested it myself because there's no test data supplied 🙂
WITH CTE_2010 AS
(
Select [Business Unit],
Count([Business Unit]) [Total No Of Tenders],
Sum(Case When [Submitted Status] =...
July 26, 2012 at 3:14 am
Then Chris' method works (very fast in the presence of a Clustered Index on Col1) with just a couple o' tweeks...
UPDATE t1
SET col2 = x.col2
--...
July 26, 2012 at 2:33 am
Record_Type & Tag_Lot_No must appear somewhere else in the database - hopefully in the tables you want to join to. If they do, you will need to add the...
July 25, 2012 at 9:10 am
You could do this:
Create table myTable (ID int, col1 int, col2 int);
insert into myTable values (1, 10, 15);
insert into myTable values (1, 20, 25);
insert into myTable values (1, 30, 45);
insert...
July 25, 2012 at 7:47 am
It depends what front end you're using. You might use ADO.NET with a transaction, or you could set up individual SQL stored procedures to insert the master & child...
July 25, 2012 at 3:54 am
It would be something along these lines:
DECLARE @MyTableVar TABLE
(
empcode nvarchar(300)
);
BEGIN TRANSACTION
BEGIN TRY
-- Update master table
INSERT INTO EmployeeMaster.....
OUTPUT INSERTED.empcode INTO @MyTableVar
-- Update child table
INSERT INTO EmployeeDetail (empcode,...
July 25, 2012 at 2:25 am
Try this:
--Activate the EXEC & comment out the PRINT.
IF OBJECT_ID('tempdb..#tables') IS NOT NULL DROP TABLE #tables;
IF OBJECT_ID('tempdb..#Columns') IS NOT NULL DROP TABLE #Columns;
select *
into #tables
from sys.tables where type =...
July 24, 2012 at 10:37 am
Viewing 15 posts - 376 through 390 (of 394 total)