Viewing 15 posts - 46 through 60 (of 920 total)
What about using a real identity column with a computed column for your "identity" column?
create table testid(
id int identity(0,1),
fakeid as id%100)
March 12, 2004 at 1:15 pm
I need to store an array of bits. I was trying to use bigint that gives me 64 bits but, I can't set all of the bits in 1 cause...
March 12, 2004 at 12:52 pm
This proc is essentially real-time by default; it will be executed immediately unless you include an optional @whentype other than 1. The fun of using this proc in a trigger...
March 12, 2004 at 11:11 am
You can use the sp_makewebtask system stored procedure for this; read about it in BOL. You'll probably want to use a template file.
Using a trigger for something like this incurs...
March 12, 2004 at 10:14 am
I don't think this is implied. It is easily conceivable to need such a query in a properly normalized database. This is a history table of each change in an employee's status,...
March 12, 2004 at 9:56 am
Okay, how about something like this?
SELECT a.Col + b.Col
FROM #Tab a JOIN #Tab b ON a.Id <> b.Id AND a.Col <= b.Col AND NOT (a.Col = b.Col AND a.Id > b.Id)
March 12, 2004 at 9:13 am
Or just something like this:
UPDATE p SET PriceName = LTRIM(STR(ISNULL(
(SELECT MAX(Price)
FROM PriceName
WHERE Price < p.Price),CASE WHEN Price IS NULL THEN
(SELECT MAX(Price)
FROM PriceName) ELSE 0 END))) + ISNULL('-' + LTRIM(STR(Price)),'...
March 12, 2004 at 8:05 am
Unless the master database uses a case-sensitive collation (which would be unusual and requires changing the collation when the server or instance was installed), SQL passwords are case-insensitive...
March 12, 2004 at 8:00 am
If this is just an ad hoc utility, I'd just cheat and do something like this:
DECLARE @value datetime, @sql varchar(400)
SET @value = '20040129 15:00:00'
SET @sql =...
March 12, 2004 at 7:43 am
Perhaps something like this:
SELECT p.EmployeeID, p.LastName, p.FirstName
FROM Personnel p JOIN
(SELECT EmployeeID, MAX(UpdDate) LastDate
FROM Personnel
GROUP BY EmployeeID) x ON p.EmployeeID = x.EmployeeID AND p.UpdDate = x.LastDate
March 11, 2004 at 7:33 pm
Okay, now I finally know what you're trying to do here.
In SQL, it's a good idea to have a primary key...
March 11, 2004 at 7:18 pm
You only need one SET keyword; i.e.:
update tbl_a
set tbl_a.column1 = tbl_b.column1,
tbl_a.column2 = tbl_b.column2,
tbl_a.column3 = tbl_b.column3,
tbl_a.column4 = tbl_b.column4,
tbl_a.column5 = tbl_b.column5,
tbl_a.column6 = tbl_b.column6
from tbl_a,tbl_b
--join tbl_b
--on tbl_a.key_id = tbl_b.key_id
where tbl_a.column5 = tbl_b.column5
and tbl_a.column6...
March 11, 2004 at 3:17 pm
The "problem," then is not with the code but instead with your examples. How about:
SELECT a.Col + b.Col
FROM Table a JOIN Table b ON...
March 11, 2004 at 3:13 pm
Working from your narrative rather than that interesting code, perhaps you want something like this:
SELECT Ref, SUM(CASE Armazen WHEN 1 THEN EpcPond END) ARM1, SUM(CASE Amazen WHEN 3 THEN -EpcPond END)...
March 11, 2004 at 3:09 pm
I suspect there's a flaw in your SQL code. You evidently haven't shared much of it. Without seeing the actual code, it's near impossible to guess at the cause of...
March 11, 2004 at 3:01 pm
Viewing 15 posts - 46 through 60 (of 920 total)