SQL Questions


How do I use primary keys in SQL server?
I have a table called course,and course_id is primary key in this table. I created another table subject.I mapped these 2 tables by course_id as foreign key,I  created another table teacher,i want to map this with subject, only subject_id to teacher_id mapping is required,how i mapp this,can i use course_id?  

Answer Question   |  September 9, 2010  7:03 AM
Primary keys, SQL, SQL Server, SQL tables
asked by:
75 pts.

XML Schema Problem
hi I have an xml file <UserRoleConsumers> <UserRoleConsumer> <ConsumerID>67</ConsumerID> <RoleConsumerID>89</RoleConsumerID> </UserRoleConsumer> <UserRoleConsumer> <ConsumerID>45</ConsumerID> <RoleConsumerID>78</RoleConsumerID> </UserRoleConsumer> … …. … </UserRoleConsumers> while creating a schema for this CREATE XML SCHEMA COLLECTION UserRoleConsumerSchema AS ‘ <schema xmlns=”http://www.w3.org/2001/XMLSchema”> <element name=”UserRoleConsumers”> <complexType> <element name=”UserRoleConsumer”> <complexType> <sequence> <element name=”ConsumerID” minOccurs=”1″ maxOccurs=”1″ /> <element name=”RoleConsumerID” minOccurs=”1″ maxOccurs=”1″ /> </sequence> </complexType> </element> </complexType> [...]

Answer Question   |  September 3, 2010  10:37 AM
SQL, SQL Server, SQL Server 2008, XML and XML schema, XML File Creation
asked by:
5 pts.

Parameter Date Conversion in SQL 2000
my code is : string sql="insert into dummy(date)values(@date)"; sqlcommand cmd=new sqlcommand(sql,con); cmd.parameters.add("@date",sqldbtype.datetime).values=maskedtextbox1.text text; cmd.executenonquery(); the problem is it's throw and error like  conversion of varchar to date; Note :- my demand to put date in DD/MM/YYYY format. 

Answer Question   |  September 3, 2010  4:22 PM
C#, SQL, SQL 2000, SQL commands, SQL Parameters, SQL Server, String manipulation, Visual Studio 2005
asked by:
260 pts.

Benefits/disadvantages of hosting SQL server on site versus MySQL in cloud?
What are the benefits or disadvantages of hosting a SQL server on site or using a MYSQL server in the cloud? The MYSQL box is much cheaper is there anything I will not be able to do with my web app using MYSQL?

Answer Question   |  November 3, 2010  8:14 PM
Cloud Computing, Cloud Computing in 2010, Cloud Services, MySQL, SQL, SQL Server, SQL Server administration
asked by:
1,110 pts.

SSRS Dynamic Report Parms
I am desiging a report to use several parameters. The first parm is report type. I need the other parameters to show or hide depending on the selection made to the first parameter. Can anyone help? Thanks

Answer Question   |  September 1, 2010  4:14 PM
SQL, SQL Parameters, SQL Server, SQL Server 2008, SSRS, SSRS reports
asked by:
5 pts.

Connect JasperServer and Sql 2008
i tired these steps : # Download the Microsoft JDBC driver: Microsoft SQL Server JDBC Driver # Extract to a good location. I chose c:program files to extract to. # Copy the sqljdbc4.jar to your installation directory which by default is: c:program filesjasperserver-pro-3.5.1apache-tomcatwebappsjasperserver-proWEB-INFlib # Restart JasperServer (there is a shortcut in the start menu to [...]

Answer Question   |  September 1, 2010  4:03 AM
Jasper, JasperServer, JDBC, SQL, SQL 2008, SQL Server 2008, SQL Testing
asked by:
5 pts.

Enherit column attributes when ALTERing column
I have this: 1. A field-reference table (fieldref): CREATE TABLE mylib/fieldref ( A CHAR (10) NOT NULL WITH DEFAULT, B CHAR (10) NOT NULL WITH DEFAULT, C DECIMAL (7 , 5) NOT NULL WITH DEFAULT, PRIMARY KEY (A)) 2. A data table (myfile) created on the basis of the above fieldref table: CREATE TABLE mylib/myfile [...]

Answer Question   |  August 30, 2010  8:21 PM
AS/400 DB2, AS/400 tables, OSV6R1, SQL, V6R1
asked by:
2,540 pts.

Prophet 21 Database Dictionary
Is there a data dictionary for the prophet 21 database? I am looking to create applications that use data stored by prophet 21 software. Is there available software to interface with prophet 21 data?

Answer Question   |  August 27, 2010  2:20 PM
Application software, Data Dictionary, Database, Prophet 21, SQL, SQL Database
asked by:
5 pts.

Crystal Reports XI – SQL table fields that fail all compare tests
I have an SQL table with a field that Crystal XI displays as string 300, call it mytable.mystring. If I create a formula field (myformula) such as… if {mytable.mystring} = “test value” then 1 else 2 This is what happens during execution…  when the the preceding test is true, Crystal returns a value of 1 [...]

Answer Question   |  August 26, 2010  3:15 PM
Crystal Reports XI, Crystal XI, SQL, SQL Server, SQL tables, Windows Server
asked by:
35 pts.

SQL Server 2005 maintenance plans
I have several maintenance plans setup in SQL 2005, but if the backup fails I am not alerted in any manner how can I fix this? Will I need to script something or is this a built in feature?

Answer Question   |  August 26, 2010  1:16 PM
Backup, Maintenance Management, SQL, SQL 2005, SQL Manager, SQL Scripting, SQL Server 2005, SQL Server 2005 backup
asked by:
975 pts.

SQL Work Files
In the FOCUS programming language, you can retrieve data and hold that data for further processing at some point later in the program.  What is the best technique for doing this in SQL?

Answer Question   |  August 26, 2010  12:23 PM
DB2 SQL, Focus, Programming Languages, SQL, SQL Database, SQL Server, Work Files
asked by:
5 pts.

Indexing in Microsoft SQL
What is an index in Microsoft SQL? What types of indexes are available in SQL Server 2005? Do I need to know about this to create and deploy a database?

Answer Question   |  August 27, 2010  8:08 PM
Database design, SQL, SQL Database, sql indexes, SQL Server 2005, SQL Server 2005 index strategy
asked by:
975 pts.

AS400 to SQL
I am going to be leading a project to convert old AS400 data to SQL, and build a web front end.  Does anyone have a project charter, project plans etc I could use a a baseline for my write?  I’m looking for the whole gambit of information surrounding this ‘conversion’ and lessons learned etc.  Thanks [...]

Answer Question   |  August 25, 2010  1:50 PM
AS/400, Conversion, Java, Project management, SQL
asked by:
15 pts.

Changing item color in Listbox
I fill the listbox with tables from SQL base The colums are b1,b2,b3,b4,b5,b6,b7 There are up to 1 million rows in listbox example b1,b2,b3,b4,b5,b6,b7 are as follows: 1,2,3,4,5,6,7 4,5,14,25,35,36,39 14,15,22,23,25,30,31 1,7,14,18,22,26,30 If any row contain any of this numbers(1,4,14,23,35,36,37) that item should given a different color from listbox’s fore color as bellow 1,2,3,4,5,6,7 4,5,14,25,35,36,39 14,15,22,23,25,30,31 [...]

Answer Question   |  August 24, 2010  7:46 AM
ListBox, SQL, VB.NET 2008, Visual Studio, Visual Studio 2008, VS 2008
asked by:
110 pts.

Receiving result sets in RPG (prior to release 7.1) from an SQL SP
I have read through the IBM manual “Stored Procedures, Triggers, and User-Defined Functions on DB2 Universal Database for iSeries” for information related to returning a result set(s) from a stored procedure into an RPG program. The manual states that a Global Temporary table must be used for this as it cannot access the result set [...]

Answer Question   |  August 26, 2010  5:45 PM
i5, RPG, SQL, SQL stored procedures, Stored Procedures
asked by:
5 pts.

SQL problem: Adapting code fragment
How do I adapt the fragment of code below to show: a) Two columns – the Filipino Population and the Total Population  b) The Filipino Population as a percentage of the total population  SELECT DISTINCTROW POPDATA.CITYNUM,  COUNT(*)FROM POPDATA  WHERE POPDATA.ANCNUMBER=720  GROUP BY POPDATA.CITYNUM  ORDER BY COUNT(*) DESC;

Answer Question   |  August 23, 2010  10:56 AM
Access 2007, SQL, SQL commands, SQL Server
asked by:
5 pts.

Create SQL statement in VBA Access 2007
How can I create a select Group BY SQL statement inside a VBA module? I’ve ran actions queries and they seem to take an effect in my tables but I’m having a difficult time creating a Select statement. Please display a couple of samples

Answer Question   |  August 18, 2010  5:15 AM
Access 2007, Access VBA, SQL, SQL statement, VBA, VBA Access 2007
asked by:
20 pts.

To increase number and combine data using sql
hi, I want to create a sql that generate a number of 4 digits with combination of character input.The number will increase if it is new record. for example : category = ‘P’ so the output will be :  P-0001 for the next record the output will be : P-0002 any ideas? thanks.  

Answer Question   |  September 22, 2010  3:39 AM
Oracle, SQL, SQL Data Set, TOAD
asked by:
5 pts.

SQL Query to consolidate rows into new table
Hi again, I have another query to get my head around! I am trying to take an existing table in a database that looks like this Time Type Price Code 09:00:01 BID 99 A 09:00:01 ASK 100 A 09:00:01 BID 99.5 B 09:00:01 ASK 100 B 09:00:02 BID 99.3 A 09:00:03 BID 98.5 C 09:00:03 [...]

Answer Question   |  August 11, 2010  11:09 AM
Access, SQL, SQL Query, SQLite
asked by:
20 pts.

SQL Query to get the difference from average for every row with grouping
Hi there, i was wondering if anyone would be kind enough to help with something i am struggling with… I have a table something like this: Region ID Cost s1 1 v1  s1 2 v2  s1 3 v3 s2 4 v4 s2 5 v5 s2 6 v6 What I am trying to achieve is to [...]

Answer Question   |  August 11, 2010  10:54 AM
Access, SQL, SQL Query, SQLite
asked by:
20 pts.