Tag Archives: express

Declaring variable in WITH expression (SQL Server)?

Questions: is there a way to define a variable inside a WITH expression? Something like: ;WITH SomeName AS ( declare @somevar decimal set @somevar = … SELECT ….) Possible? Answers: No, you would need to declare / set it outside of the CTE DECLARE @somevar DECIMAL ;WITH SomeName AS (SELECT….) SELECT @somevar = … FROM… Read More »

SQL Server regular expressions

Questions: Wondering if it is possible to incorporate regular expressions into a SQL statement on SQL Server? I’m only finding that Oracle supports Regular Expressions. Answers: No, not without extra help such as writing a CLR function or something similar. T-SQL doesn’t have builtin support for regular expressions. Questions: Answers: SQL Server supports limited pattern… Read More »

Redundant Nginx Location and Rewrite Regular Expression

Questions: I have a location and rewrite directive pair that works, but there is a redundancy that it seems like I should be able to optimize out. It takes an external URL like /css/20141201-styles.css and delivers /css/styles.css. location ~ ‘^/(css|js)/[0-9]{8}-‘ { rewrite ‘^/(css|js)/[0-9]{8}-(.*)$’ /$1/$2; } It seems like I’m doing work twice, once in matching,… Read More »

Using tsql greater than sign in CASE Expression

Questions: (case [dbo].[YearsInService]([DateEngaged],getdate()) when (0) then (0) when (1) then (4) when (2) then (8) when (3) then (12) when (4) then (32) when (5) then (40) when (6) then (48) when (7) then (56) when (8) then (104) when (9) then (117) when (10) then (150) else (-1) end) Now in my the last… Read More »

Why would an xpath position selection expression return multiple nodes?

Questions: While working with xpath (which hasn’t been very long), I came across something odd. Shortened version of the xml (The full xml is here and a snapshot is available on pastebin): <?xml version=”1.0″ encoding=”utf-8″ ?> <body copyright=”All data copyright San Francisco Muni 2013.”> <route tag=”all”> <message id=”10268″ creator=”jflynn” startBoundary=”1378121400000″ startBoundaryStr=”Mon, Sep 02 04:30:00 PDT… Read More »

MySQL versus SQL Server Express

Questions: Did the recent purchase of MySQL by Sun and the subsequent buggy releases kill the MySQL brand? I whole heartedly embraced MySQL when it first came out as I used to be a poor developer and all the RDBMs were too expensive. I have fond feelings for MySQL and their being able to compete… Read More »

Express + Nginx. Can't serve static files

Questions: This is my project folder / public/ index.html main.js adaptor.js main.css node_modules/ socket.io/ index.js and this is static file configuration in my index.js app.use(express.static(path.join(__dirname, ‘/public’))); app.use(express.static(path.join(__dirname, ‘/node_modules’))); app.get(‘/’, (req, res)=>{ res.sendFile(path.join(__dirname, ‘public’, ‘/index.html’)); }) and this is my index.html <script src=”/socket.io/socket.io.js” charset=”utf-8″></script> <script src=”/adapter.js” charset=”utf-8″></script> <script src=”/main.js” charset=”utf-8″></script> and this is my nginx configuration… Read More »

SQL Server Subquery returned more than 1 value. This is not permitted when the subquery follows (chars) or when the subquery is used as an expression

Questions: I am trying to update some fields based on their occurence. If they only occur one time, I am updating some status field. My current code is as follows: UPDATE table1 SET statusField = 1 WHERE someID = ( SELECT someID FROM table1 GROUP BY someID HAVING COUNT(*) = 1 ) This returns an… Read More »