The Invention of “CharvaScript”
James (at work) said to me out of the blue that he thought of a language when at uni to be called “CharvaScript”.
Apart from making me laugh, it made me think a little. So I thought some more. Then I stopped thinking and picked my nose. Then I thought some more again.
I came up with [...]
DataRow[DataColumn] performance enhancements
Since the system I work on performs about 1000 DataTable specific manipulations per minute, I’ve been going through and working out some ways to speed it up that little bit more. Take the following code:
DataTable myData = new DataTable();
myData.ReadXml(“myxml.xml”);
if (myData.Rows[0].IsNull(“column1″))
return null;
else
return myData.Rows[0]["column1"];
The obvious performance improvement here is to first pull out the column [...]
T-SQL Race Conditions (and how to avoid them)
I’ve been writing T-SQL stored procedures for many years now, and I never fully understood how the concurrency of multiple users truly affects the asynchronous operation of certain types of paradigms until now.
Take the following T-SQL:
SELECT @ID = ID FROM tblTable WHERE nvhSomeText = ‘match’
IF @ID IS NULL
INSERT INTO tblTable (nvhSomeText, intSomeNumber) VALUES (‘match’, 10)
ELSE
UPDATE [...]
DECLARE CURSOR … FOR UPDATE
Just a quick post to basically document somewhere the problem I was getting and the solution I found.Take the following cursor declaration:
DECLARE cur_Columns CURSOR LOCAL
FOR SELECT DISTINCT person_id
FROM Company_People
WHERE company_id = @company_id
FOR UPDATE OF person_id
There is no obvious reason to me why this should not work, but attempting to use this cursor for updating a column will fail with [...]
