I have a student marks table with schema as given below:
Student
--------
SNO
Marks
I want to produce a result something as this:
MarksRange Count
---------- ------
0 10
10 2
20 43
: :
100 2
The above results shows that there are:
10 students who got a score zero,
2...
Hi...
I want to create a complex type to use within an entity manager from a query constructed dynamically and executed with exec(). Is it possible?; since I'm writing a filter, what would you do instead if it is not possible?
Also, I'm evaluating using linq, but the filter needs many tables and their registers, therefore efficiency is...
I have the following tables in a SQL Server 2008 db:
tblItem, which has an ItemID field;
tblGoodItem, which also has an ItemID field, and has a foreign key pointing to tblItem;
tblBadItem, which also has an ItemID field, and also has a foreign key pointing to tblItem.
An item cannot be both a good item and a bad item; it must either ...
I'm new to Firebird, and I'm having particular difficulty translating this T-SQL to Firebird SQL. This code is stored outside of the database, not in a stored procedure.
DECLARE @NumTotal int
DECLARE @NumUsed int
SELECT @NumTotal = COUNT(*)
FROM "some_Table"
WHERE "CreatedOn"=@CreatedOn
SELECT @NumUsed = COUNT(*)
FROM "som...
I'm working on a project that is subject to certain corporate standards relating to SQL implementation. Specifically, that all SQL Server content be accessed only via stored proc. (No ORM or LINQ.)
80% or more of our needs can be handled through the basic CRUD (CREATE, READ, UPDATE, DELETE) type of procedure that should be fairly si...
I renamed a table in my database with
EXEC sp_rename 'tblOldAndBusted', 'tblNewAndShiny'
and all the foreign key constraints were updated to the new table name, but they're still named based on the old table name. For example, I now have FK_tblOldAndBusted_tblTastyData but I'd like to have FK_tblNewAndShiny_tblTastyData.
Is there an ...
We are running SQL Server 2008 on 64bit boxes. We've had a request to create a query that has a Where clause that draws data from an Excel table. In pseudo code, the query might look as follows:
Select column1, column2, column3
From MyDatabase.MyTable
Where column4 IN (Select all values from column 'A' in SubIDs.xls whose sheet name is ...
So upon a method call to a webservice, I'm getting this error:
"System.ServiceModel.FaultException`1[System.ServiceModel.ExceptionDetail]: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that ...
Say I have "Table A":
Id | Col A
1 Z
2 I
3 Null
...and n number of tables that have this format:
Id | A_FK | OtherInfo
1 1 "Some info"
2 2 "Some more info"
3 3 "Blah"
...where A_FK is a foreign key reference to the "Table A" Id.
So there is one "Table A", and n number of "Table B's". For these "B" ...
Is there a way to search for a specific varchar value across all fields in a SQL Server DB?
...
I have a long running query that returns a large data set. This query is called from a web service and the results are converted to a CSV file for the end user. Previous versions would take 10+ minutes to run and would only return results to the end user once the query completes.
I rewrote the query to where it runs in a minute or so i...
In my database I have certain data that is important to the functioning of the app (constants, ...). And I have test data that is being generated by testing the site. As the test data is expendable it delete it regularly. Unfortunately the two types of data occur in the same table so I cannot do a delete from T but I have to do a delete ...
I have a large, messy report to write that joins across 5 tables. There is one column in one table that is being used for several different values--essentially a "tag" column, where the tags are used in creative ways depending on what kind of miscellaneous metadata the users want to use.
As a result, my query for the report returns 3 ne...
Hi,
I am making a db schema for facebook like wall structure. I need to save wall posts, share a link, share a video stuff into my database. Till now I am able to make this schema :
GO
CREATE TABLE [Wall]
(
[ID] [int] NOT NULL IDENTITY(1, 1) ,
[PostText] [nvarchar](MAX)
[PostedByUserID] [int] NULL ,
[PostedO...
I have this query that is optimized for speed (that's why it might look a bit odd - got some help a while back).
Want the exact result as this BUT I ONLY want results from within the LAST minute not older.
This query returns the last 100 no matter what and not only results from the last minute.
SessionGuid is not unique - in fact it'...
Dear friends,
I'm supposed to do the fallowing:
1) read a huge (700MB ~ 10 million elements) XML file;
2) parse it preserving order;
3) create a text(one or more) file with SQL insert statements to bulk load it on the DB;
4) write the relational tuples and write them back in XML.
I'm here to exchange some ideas about the best (== fast...
In terms of performance, how does the like operator behaves when applied to strings with multiple % placeholders?
for example:
select A from table_A where A like 'A%'
takes the same time to select than
select A from table_A where A like 'A%%'
???
...
Hi,
I would like to request opinions in order to approach internationalization of a website in C#.
I´m working with resx files to define strings of text. I would like to know if its possible to use resx to define categories - eg: commerce website - or its preferred to use a table in the database with a foreign key to table category?.
...
I have a suite of database unit tests that were created. In order to replicate all of the tests on any machine I deploy out to there are scripts to drop the database and recreate it. The test will work for all of the unit tests except for the first test.
The reason the first test fails is that I am executing the "dbcc checkident" comma...
Hi,
I am having a large table say 10 columns. 4 of them remains null most of the times. I have a query that does null value takes any size or no size in bytes. I read few articles some of them are saying :
http://www.sql-server-citation.com/2009/12/common-mistakes-in-sql-server-part-4.html
"There is a misconception that if we have the ...