I have a form into which the visitor can enter data, and I want to store this data in a mysql database via the $_POST variable. What do I need to prevent sql injection?
Hi,
I want to translate LINQ expression tree to SQL statement and I don't want to write my own code for this.
Example:
var query = from c in Customers
where c.Country == "UK" &&
c.City == "London"
select c);
To
SELECT ... FROM Customers AS c WHERE c.Country = "UK" AND c.City = "London"
I know DataContext.Log, but I want to use:
query.ToSqlStatementString()
Thanks
Hi,
I would like to select a random line in my database. I saw this solution on a website:
SELECT column FROM table
ORDER BY RAND()
LIMIT 1
This SQL query run but someone said me that it was a non performant query. Is there another solution ?
Thx
Hi guys:
Suppose we got a original query as follows:
SELECT A, B, C FROM tblA
Now, I need to additional artificial rows like
SELECT 'Kyala', B, C FROM tblA when, for example, C = 100 to be inserted into the resultset.
How could I achieve it using a single SQL instead of relying on table variable or temp table?
Hello,
We have observed that there seems to be a maximum number of ids/variables which one can pass in the IN clause of SQL as comma seperated values. To avoid this we are storing all the ids in a table and doing a SELECT within the IN clause. This however means extra database operations to store and retrieve ids. Is there any other way to use IN without SELECT?
regards
Sameer
thanks for yout time helping on this ;)
I'm new to SQL and wish to solve somethign in just one query and i dont know how to do it.-
Basically I've a table of products, a table of users and a table of comments, linked by products.id - comments.pid and user.id - comments.uid ,
i wish to know what is the best practice to create just 1 query and get all products with child comments, including username.
Hi,
what is index in sql can u explain or any reference to understand clearly. where should i use the index. I search in stackoverflow but it is not clear for me. thank you
how to
compare the values of same table(say for eg: Order table) each and every time the record get inserted ,
if the record with same values get inserted already in same table i should not insert the new record with same values. how to do that exactly in sql server 2008
Hi,
I have a table of items stored this way :
A1 | B1
A1 | B2
A1 | B3
A2 | B1
A2 | B4
...
And I need to retrieve with a SQL Query :
A1 | B1, B2, B3
A2 | B1, B4
...
Hey, I've just finished writing a VB.NET application. Now I want to package the executable and the database ofcourse into a single installer file. I tried using QSetup, InstallShield to make SQL Server embedded into the setup file, and finally after hours of try&fail I have no idea. Anyone?
Hi,
I have a server where I installed SQL Server 2008 and after I applied the SP1.
Now, I want also to add the Analysis Services to this instance by using the "Add or remove features...".
My questions are:
Is it possible to add the Analysis Services on a server with SP1 already installed?
How can I apply the SP1 also to the new Analysis Service feature?
THANKS!
How would one go about converting this into a UDF? I'll pass the product_id to the UDF.
Running SQL 2k5
SELECT
sum(qty) as qty,
product_id
FROM vProductQuantity
WHERE
product_id = @product_id
GROUP BY product_id
Is there any way showing the detailed exception for String or binary data would be truncated.
I use LINQ to SQL and i cant figure out which column is that!?
Tried numerous things but i get the same meaningless error i got from within Visual Studio.
Also I use .NET 3.5 SP1, but errors are still returned useless.
hi
i have 4000 records, and i need to pick randomize 500 records.
i need that 500 records will insert to GoodTable
and the rest 3500 records will insert to BadTable
how to do it using sql-server 2008 query ?
thank's in advance
Hi all, i want to ask about development in blackberry. I have background in .Net winform.
If i want to develop an application to show data from Ms.SQL server 2008 database in blackberry. what should i learn and what should i do ? thank you for your advice.
I'm learning how to use SQL Server Management Studio and can't figure out how to insert a new row into a table.
Table Structure:
ID,
Field1,
Field2
Query:
INSERT INTO Table (Field1,Field2) VALUES(1,2)
Error:
Major Error 0x80040E14, Minor Error 25503
I'm probably missing something very noobie like. Any help would be appreciated.
E.g.
Declare @str varchar2(20)
Set @str = 'A Student'
Select Reverse(@str)
Output:
tnedutS A
Expected being:
Student A
The output(using Reverse) is as expected. But my requirement is the one described.
Help needed with SET BASED.
I am using SQL Server 2005
E.g.
Declare @str varchar2(20)
Set @str = 'A Student'
Select Reverse(@str)
Output:
tnedutS A
Expected being:
Student A
The output(using Reverse) is as expected. But my requirement is the one described.
Help needed with SET BASED.
I am using SQL SERVER 2005
What is a candidate row when talking about Oracle and SQL? Using it in a sentence would be as such:
"The candidate row is fetched from the table specified in the outer query."
Hi
I use SQL server 2008 and I have created some tables but I want to edit some of them but it does not let me and will show an error ! how can i solve my problem ??? please help me
I store an XML string in a column in my SQL Server database. I'm trying to run an UPDATE statement that will make a certain field into Upper Case. I can do that easily during a SELECT but can't get it to work with an update.
This SELECT statement works
select Upper(XmlTest.value('(/CodeFiveReport/Owner/@UnitNumber)[1]', 'varchar(10)')) as UnitNumber
from uploadreport
But I want to update it the XML as that permanently
Update table Set XmlString.Modify('replace value of (/Root/Node/@Field)[1] with ?
How to find out the last date and timestamp of schema updation in SQL Server database. I could locate the database created and last back up date from properties. But, couldn't find the last schema updated date. Is there a way to find this out?