I want to do something like this:
declare @temp as varchar
set @temp='Measure'
if(@temp == 'Measure')
Select Measure from Measuretable
else
Select OtherMeasure from Measuretable
...
I've written a linq-to-sql program that essentially performs an ETL task, and I've noticed many places where parallelization will improve its performance. However, I'm concerned about preventing uniquness constraint violations when two threads perform the following task (psuedo code).
Record CreateRecord(string recordText)
{
using ...
I have this stored procdure
CREATE PROC dob.p_foobar
(
@foo bit = NULL,
@Bar bit = NULL
)
AS
IF @Foo == 1
BEGIN
SELECT 'Hello, World'
END
When I parse, I get the error "Incorrect syntax near '='".
Please tell me what I'm doing wrong. I know it's something stupid, but I just can't figure it out.
Thank you
...
I use GET to get the id of a result.
$id = $_GET['id'];
I then use the following code:
<?
$q = $database->friendlyDetails($id);
while( $row=mysql_fetch_assoc($q) )
{
$hu = $row['home_user'];
$ht = $row['home_team'];
$hs = $row['home_score'];
$au = $row['away_user'];
$at = $r...
I've created a logon trigger in MS SQL that needs to check dm_exec_sessions for a login. This login is the user listed in the connection string and has owner right to the database. If the login is verified, I need it to update a specific table and send an email.
So far I've done just the following piece and it disabled my web site. The ...
I have a table with lets say 2 columns. id number, and value. Value is a string (var char).
Lets say i have a number x, and a list of numbers a1, a2, a3, a4, a5..... where x is not in the list. All of these numbers correspond to a unique row in the table. I want to know if the string value for x in the table is contained in one of the s...
When I create a view I am basically like making a new table that will automatically be transacted upon when data in one of the tables it joins changes?
Also why can't I use subqueries in my view????
...
When i should use primary key or index?
Which are the differences between primary key and index and which is the best?
...
I have a database with up to some n entries allowed. Periodically, it needs to be trimmed down to the most recent m entries.
The table (call it mytable) has a datetime stamp runstamp
My general thought was to run a query like this
delete from mytable where runstamp <
(select min(runstamp) from mytable order by runstamp limit m)
...
I have an application where users can select a variety of interests from around 300 possible interests. Each selected interest is stored in a join table containing the columns user_id and interest_id.
Typical users select around 50 interests out of the 300.
I would like to build a system where users can find the top 20 users that have ...
I need to retreive a list of posts that have (at least) one attachment that belongs to a category in WordPress.
The relation between attachments and categories I made by myself using the WordPress default method.
Here's the query that i'm running right now:
SELECT post.*
FROM `bma_posts` AS post
WHERE
EXISTS (
SELECT 1
...
For a database I'm building, I've decided to use natural numbers as the primary key. I'm aware of the advantages that GUID's allow, but looking at the data, the bulk of row's data were GUID keys.
I want to generate XML records from the database data, and one problem with natural numbers is that I don't want to expose my database key's t...
While coding with sqlite everytime i always had the exact number of parameters and when i executed the query i always had 0 parameters after it. I kept using the cmd object and it worked fine.
Now while porting to use sql server (2008) my SqlConnection has parameters left over from a successful command. Why? I seem to be able to create ...
What are some of the methods/techniques experienced SQL developers use to determine if a particular SQL query will scale well as load increases, rows in associated tables increase etc.
...
Does anyone know any good tutorial on how to upload a file with php and save the files path to a sql server?
...
I am trying to migrate sharepoint wss 3.0 databases from SQL Express 2005 to SQL 2008 Workgroup edition.
I have backed up the database, but not sure how to best attached/restore them to the new version and get up and running again.
Thanks
...
Hi
I am wondering is there a way to do batch updating? I am using ms sql server 2005.
I saw away with the sqlDataAdaptor but it seems like you have to first the select statement with it, then fill some dataset and make changes to dataset.
Now I am using linq to sql to do the select so I want to try to keep it that way. However it is t...
I use MySQL and it gives no meaningful error messages beyond "syntax wrong close to something or other". This is in sharp contrast to the sort of nice, clear error messages we are used to getting from java compiler and similar. So, are there RDBMS or sql validation tools that provide clearer, meaningful error messages?
...
I have the following result set from a join of three tables, an articles table, a products table, an articles to products mapping table.
I would like to have the results with duplicates removed similar to a select distinct on content id.
Current result set:
[ContendId] [Title] [productId]
1 article one 2
1 ...
Hi
I am using ms sql server 2005 and I want to do a mass update. I am thinking that I might be able to do it with sending an xml document to a stored procedure.
So I seen many examples on how to do it for insert
CREATE PROCEDURE [dbo].[spTEST_InsertXMLTEST_TEST](@UpdatedProdData XML)
AS
INSERT INTO
dbo.UserTable(CreateDate)...