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
From here
ALTER TABLE ORDERS
ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID);
How do i add several keys with SQL Server? is it something like the below? (I cant test ATM and unfortunately i have no way to test queries unless i run it through code)
ALTER TABLE ORDERS
ADD FOREIGN KEY (customer_sid) REFERENCES CUSTOMER(SID),
ADD FOREIGN KEY (customer_sid2) REFERENCES CUSTOMER(SID2);
or is it like
ALTER TABLE ORDERS
ADD FOREIGN KEY (customer_sid, customer_sid2) REFERENCES CUSTOMER(SID, SID2)
Hi,
I want to add browsable attribute to some properties for entities generated by linq-to-sql.Is it a good idea? Since,these entities are auto-generated,and when I regenerate they(the attributes I have added) might be overwritten
Hi,
I have to run a query in the loop in SQLPLUS. and the count of loop is coming from some other SQL query. So i have to declared a variable which will take the value of count. Now I want to use this variable in my query. How would i be able to do the same . Please suggest me
Thanks in advance
Hi,
I have an SQL query that returns an amount of tuples (about 50).
Now I need to display the results, 15 tuples at a time, then I will have a "view more" button to view the next 15 results.
Can you please help me how I can make this? The issue is that I cannot use the 'limits' because each time I run the query the results will be different, hence when pressing view more, I may get the same results of the same page.
thanks
Hi i want to display join result of two tables but don't want to show matching column separately. I want it one instead of two. so please tell me what query should i use for this. I m using sql server 2008 and my query is like:
select * from Customer_Order, optRelation where Customer_Order.orderNumber = optRelation.orderNumber AND optRelation.orderNumber = 21. please reply soon
I have two tables that have relationship with UserName field. Based on UserName column, I want to get ID from CarReserve table. Here is my SQL statement:
SELECT CarReserve.ID
FROM CarReserve
INNER JOIN aspnet_Users ON CarReserve.UserName = aspnet_Users.UserName
WHERE UserName = @UserName
Unfortunately, I am getting this warning:
Ambiguous column name "UserName"
Can anyone here tell me what is wrong with my statement?
I'm trying to learn SQL to store the data rather than reading the file and populating the whole data structure in memory. would it be like reading the data from disk instead of direct memory?
Hello Everybody,
I've got a question regarding a SQL-select-query:
The table contains several columns, one of which is an Integer-column called "size" - the task I'm trying to perform is query the table for the sum of all rows (their values), or to be more exact get a artifical column in my ResultSet called "overallSize" which contains the sum of all "size"-values in the table. Preferable it would be possible to use a WHERE-clause to add only certain values ("WHERE bla = 5" or something similar).
The DB-engine is HSQLDB (HyperSQL), which is compliant to SQL2008.
Thank you in advance :)
Hi, I have two dates of the form Start Date: 2007-03-24, End Date: 2009-06-26
Now I need to find the difference between these two in the below form:
2 years, 3 months and 2 days
Can someone please … in SQL Server 2005
Was wondering if any one could recommend any and all books for learning more about SQL and DB concepts?
I found this one while browsing SO, but was wondering if anyone had other or more up to date recommendations?
I am getting a SqlConnection does not support parallel transactions. exception and this answer mentions its when a connection tries to open two transactions. This is exactly what i am doing. I thought nested transactions were ok (i was using sqlite for the prototype).
How do i check if the connection is already in a transaction? I am using Microsoft SQL Server Database File.
I simply want to include a row number against the returned results of my query.
I found the following post that describes what I am trying to achieve but gives me an exception
http://vaultofthoughts.net/LINQRowNumberColumn.aspx
"An expression tree may not contain an assignment operator"
In MS SQL I would just use the ROWNUMBER() function, I'm simply looking for the equivalent in LINQ.
Hi,
I want to develop a function in PHP that checks how dangerous a SQL statement is. When i say dangerous i mean, certain symbols, characters or strings that are used to get data from a database that the user shouldnt see.
For example:
SELECT * FROM users WHERE userId = '1'
can be injected in several ways. Although i clean the params, i also want to monitor how safe the query is to run.
Thanks in advance
Hi,
i've coded a tiny forum software in php where people posts threads, and i want to support tags.
How many SQL tables should i make for this ? and briefly how the tags system will work?
Thanks
We need to INSERT 2000 records into SQL DB from C# .Net code.
For this is there any way to INSERT all 2000 records at a time instead of executing the INSERT query for each record.
Also how would be the performance impact of doing this?
Thanks & Regards
Padma
Hi,
I have the following table in an access database
id VisitNo Weight
1 1 100
1 2 95
1 3 96
1 4 94
1 5 93
Now row 2 and 4 are deleted. So i have...
id VisitNo Weight
1 1 100
1 3 96
1 5 93
However what i need is...
id VisitNo Weight
1 1 100
1 2 96
1 3 93
What is the SQL query i need to accomplish the above?
thanks
I need to get a list of all tables that are published for replication from MS-SQL 2005/2008 databases. Is there a system stored procedure or a query I could run to generate such a list?
Thank you,
I was wondering if there was any recommended max size for MDF and/or LDF Files for an SQL server instance.
For example, if I want to create a 400 GBytes Database, is there a rule to help me decide how many mdf files I should create ? or should I just go ahead and create a single gigantic 400Gbytes mdf file?
If so is this going to somehow affect the database performances ?
We are switching from a SQL cluster to a mirrored solution. The problem is that we have a bunch of programs that would have to switch connection strings to handle the failover. Is there any way the we can set up a redirect or proxy that would take any legacy requests and forward them to the mirrored solution?
i am going on a job interview and have zero experience with ms sql, however i have 1 year with oracle. is there such a huge difference between the two? what programming questions can i expect?
i have two tables
table1 fields
fid,fname,fage
a ,abc ,20
b ,bcv ,21
c ,cyx ,19
table2 fields
rcno,fid,status
1 ,a ,ok
2 ,c ,ok
3 ,a ,ok
4 ,b ,ok
5 ,a ,ok
i want to display rectors like this
fid from table1 , count(recno) from table 2 and fage from table1
fid,count(recno),fage
a ,3 ,20
b ,2 ,21
c ,1 ,19
i try many sql queries but got error
Thanks
We have been having problems with ghost updates in our DB (SQL Server 2005) fields are changeing and we cannot find the routine that is updating. Is there a way using an update trigger (Or any other way) to tell what caused the update?