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'm trying to pivot some data in SQL Server 2000, but the user that runs the application only have read/write permissions. I've looked the solutions posted here, but all involving create/destroy temporary tables.
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 am creating a stored procedure to which i want to pass as variable a comma delimited list of Ids
I want to use the Ids into a select statement
something like
Create Procedure up_TEST
@Ids VARCHAR(MAX)
AS
SELECT * FROM ATable a
WHERE a.Id IN(@Ids)
Obviously i get the error that @Ids is a varchar and not an INT but how can i convert the comma delimited list
I am using SQL Server 2008
Thanks
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
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
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 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
...
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.
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,
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 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
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?
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!
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 have two SQL 2005 instances that reside on different networks. I need to backup a database from instance A and restore it to a database in instance B on a weekly basis so that both databases hold the same data. After the restore, logins SIDS on database B are changed and therefore users can't log into database B and connection strings for the web application it supports are broken. Is there a work around for this? Thanks.
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."
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
Is there an easy way to do a find and replace on a string in every view and stored procedure in my SQL Server database.
I need to replace something like 'X United Kingdom' with 'X(UK)'.