In SQL Server 2008 I have a table called Zone with a column ZoneReference varchar(50) not null as the primary key. If I run the following query: select ‘”‘ + ZoneReference + ‘”‘ as …
Tag: sql
What is dynamic SQL?
I just asked an SQL related question, and the first answer was: “This is a situation where dynamic SQL is the way to go.” As I had never heard of dynamic SQL before, I immediately searched this …
SQL query that will give me the RecordedValue range each device recorded for each date
I have a table with this schema: DeviceID int FloorID int RoomID int DateRecorded datetime RecordedValue decimal A sample of the table’s data looks like: DeviceID FloorID RoomID …
How do I safely read from a stream in asp.net?
If: Reading from a stream in a single call to Read is very dangerous. You’re assuming all the data will be made available immediately, which isn’t always the case. You should always loop round, reading until there’s no more data. How should I change the above code to make it ‘less dang…
Name database design notation you prefer and why?
Which notation, methodology and tools for database designing, modeling, diagraming you prefer and why? Which notation, standards, methodology are the most broadly used and covered by different vendors? Which are standard and which are not? i.e. which are to stick with and which to avoid? And why do you prefer…
SQL UPDATE all values in a field with appended string CONCAT not working
Here is what I want to do: current table: Mystery Query ( something like “UPDATE table SET data = CONCAT(data, ‘a’)” ) resulting table: thats it! I just need to do it in a single query, but can’t seem to find a way. I am using mySQL on bluehost (I think its version 4.1) Thanks ev…
What is the keyboard method for filtering in SQL Management Studio?
I make very heavy use of filtering in SQL Server Management Studio when working with a large number of stored procedures – but find it a slow process as I have to right click, move my mouse to select ‘filter’, type in filter, and then click OK. Is there hotkey to pull up the filter dialog wh…
How to get missing values in sql?
I need help. I have a sql table t2 related to two other tables t1 and t3. t2 has fields: I’m searching for values, where ifFromt3 is missing. I want to fint in this example, the value ifFromt3 = 3, because of it’s not present. I’m doing it like this example, but it doesn’t work correct…
using DateDiff to find duration in minutes
I am trying to use Datediff to find out the duration between columnA and columnB. This produces errors. Can anyone please help me with what I’m doing wrong? Answer how about trying this, not sure why you have stime = [exceptions2].starttime and etime = [exceptions2].endtime
How to divide two columns?
I tried to divide two columns from joined tables but the result (value of column relative_duration) is always 0. The query is the following: SELECT t1.[user_1] ,t1.[user_2] ,t1.[…