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 was wondering if it's possible to do something like this (which doesn't work):
select cast( (exists(select * from theTable where theColumn like 'theValue%') as bit)
Seems like it should be doable, but lots of things that should work in SQL don't ;) I've seen workarounds for this (SELECT 1 where... Exists...) but it seems like I should be able to just cast the result of the exists function as a bit and be done with it.
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?
Trying to convert this tax-like IRS function http://stackoverflow.com/questions/1817920/calculating-revenue-share-at-different-tiers to SQL. The assumption is the table would be one column (price) and the tiers will be added dynamically.
My first attempt has some case statements that didn't work out well. I have since scrapped it :) Thanks for the help!
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
I have table similar to the following:
Year | Product | Value
2006 A 10
2006 B 20
2006 C 30
2007 A 40
2007 B 50
2007 C 60
I would like a query that would return the following comparison
Product | 2006 Value | 2007 Value
A 10 40
B 20 50
C 30 60
What are the options to do so? Can it be done without joins?
I'm working with DB2, but answers in all SQL types would be helpful.
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)
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?
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 :)
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?
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
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.
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
This simple query throws the "Ambiguous column name TaskID" error on one db-server only. This is ridiculous. We tested this with the same database structure on different servers and different versions of ms sql (2005/2008), and it's only THIS particular client's server that throws the error. I'm actually frustrated.
SELECT Tasks.TaskID
FROM Tasks
INNER JOIN TaskHelpers ON TaskHelpers.TaskID = Tasks.TaskID
order by TaskID
Yes, I know I can put "Tasks.TaskID" into the order by clause, but for some reasons I can't.
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
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
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'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
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 ?
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
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 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,