What's the best way to calculate the distance formula around a central location using a radius in miles? We've typically been using a circular radius formula, but are considering using a plain square because it's faster and much more efficient.
Sometimes we'll need to be exact, so we'll use the circle, but other times we can just use ...
How do I return a constant from an sql statement?
For example how would I change the code below so "my message" would return if my (boolean expression) was true
if (my boolean expression)
"my message"
else
select top 1 name from people;
I am using ms sql 2000
...
I can't figure out how to get the SCOPE_IDENTITY() back to my variables from an SQL2005 Store Procedure.
My sSQL String:
sSQL = "EXEC [sp_NewClaim] " & Chr(34) & ClaimNumber & Chr(34) & ", " & Request.Cookies("UserID") & ", " & Request.Cookies("MasterID") & ", " & Chr(34) & strRestaurante & Chr(34) & ", " & Chr(34) & Fecha & Chr(34) &...
When running the following code it leaves out one row. When I do a files.Count it says there are 4 rows but there is no data stored for the 4th row. When I run the stored procedure from within SQL Manager it returns all 4 rows and all the data. Any help?
List<File> files = new List<File>();
SqlConnection active_c...
I'm trying to perform a simple INSERT and return the identity (auto-incrementing primary key). I've tried
cmd.CommandText = "INSERT INTO Prototype ( ParentID ) VALUES ( NULL ); SELECT SCOPE_IDENTITY();";
and I receive the following error
EnvironmentError: SQLite error
no such function: SCOPE_IDENTITY
Does SQLite support SCOPE_IDENTI...
MS SQL has a convenient workaround for concatenating a column value from multiple rows into one value:
SELECT col1
FROM table1
WHERE col2 = 'x'
ORDER by col3
FOR XML path('')
and that returns a nice recordset:
XML_F52E2B61-18A1-11d1-B105-00805F49916B
----------------------------------------
<...
I need to avoid being vulnerable to SQL injection in my ASP.NET application. How might I accomplish this?
...
I have an Informix SQL query which returns a set of rows. It was slightly modified for the new version of the site we've been working on and our QA noticed that the new version returns different results. After investigation we've found that the only difference between two queries were in the number of fields returned.
FROM, WHERE and OR...
Hi,
I have seen that there is a NVL function for P/SQL that substitutes a value when null is encountered.
But what if I want to set a field to NULL, e.g. EXEC SQL UPDATE mytable SET myfield=NULL WHERE otherValue=1;
When I run this with C++ on HPUX, 0L is used for null while on Linux the statement fails with "illegal value".
Is there a...
Is there a way to query the current DATEFOMRAT SQLServer 2005 is currently using with T-SQL?
I have an application that reads pregenerated INSERT-statements and executes them against a database. To make the the data to be inserted culture independent I store datetime-values represented in the invariant culture (month/day/year...) . The ...
Hi ,
Excuting the line of SQL:
SELECT * INTO assignment_20081120 FROM assignment ;
against a database in oracle to back up a table called assignment gives me the following ORACLE error:
ORA-00905: Missing keyword
...
Environment:
I'm working on a C++ application that uses SQL Native Client 9.0 to communicate with a SQL Server 2000 database.
Scenario:
2 connections are opened to the DBMS
Each connection is set to use transactions
A query on Connection1 works with TableA
A query on Connection2 works with TableB
TableB has a foreign key constraint o...
I have an already large table that my clients are asking for me to extend the length of the notes field. The notes field is already an NVARCHAR(1000) and I am being asked to expand it to 3000. The long term solution is to move notes out of the table and create a notes table that uses an NVARCHAR(max) field that is only joined in when n...
I am porting some queries from Access to T-SQL and those who wrote the queries used the Avg aggregate function on datetime columns. This is not supported in T-SQL and I can understand why - it doesn't make sense. What is getting averaged?
So I was about to start reverse engineering what Access does when it aggregates datetime using Av...
Does ODBC support asynchronous calls? If it does, then can you tell me about any reference materials?
My preferred language is C++.
...
Is there a 4 byte unsigned int data type in MS SQL Server?
Am I forced to use a bigint?
Possible Duplicate:
http://stackoverflow.com/questions/1509933/sql-server-4-byte-unsigned-int
...
Hi,
I have a fairly huge database with a master table with a single column GUID (custom GUID like algorithm) as primary key, and 8 child tables that have foreign key relationships with this GUID column. All the tables have approximately 3-8 million records. None of these tables have any BLOB/CLOB/TEXT or any other fancy data types j...
I always have this notion that writing SQL queries in the code behind is not good compared to writing it using a SqlDataSource
SqlDataAdapter ad = new SqlDataAdapter("SELECT * FROM Categories", myConnection);
DataSet ds = new DataSet();
ad.Fill(ds, "Categories");
myGridView.DataSource = ds;
myGridView.DataBind();
vs.
<asp:SqlData...
I am in the process of writing an application that will need multiple forms of authentication.
The application will need to support authentication to Active Directory, but be able to fail back to a SQL Membership Provider if the user is not in Active Directory. We can handle the failing to the SQL Provider in code based on the username...
I've been preaching both to my colleagues and here on SO about the goodness of using parameters in SQL queries, especially in .NET applications. I've even gone so far as to promise them as giving immunity against SQL injection attacks.
But I'm starting to wonder if this really is true. Are there any known SQL injection attacks that will...