Bring A Data That Not Already Selected...

Feb 12, 2006

Hi I have a problem that seems to be stupid… but still I cant solve it so please if you can help ASAP I'll appreciated.

 

Its 2 tables "Courses" and "Facilitators"

The Course table contain: Course_Id and Course_Name

The Facilitators table contain: Facili_Id and Facili_Name

 

The two tables have (many to many) relation between them.

So I split them into a 3rd table called "Trans"
  which contain the PK from each Table

That will be : "Trans_Course_Id" and "Trans_Facili_Id"

 

I put some data on each table… at least 3 records and related some of them in the "Trans" table

 

Now im looking for an SQL command that brings me All the "Facili_ID" and "Facili_Name" for a specific course. And only those who is not already selected by the same course


?


 

Like if I have the data in the "Courses" table
id: 1 and Name: VB

Id:2 and Name: C#

 

And in "Facilitators" table:

Id:1 and Name: Adam

Id:2 And Name: George

Id:3 and Name: Sam

 

Now in the relation table "Trans"

 

Course_Id:1 and Facili_Id:1

Course_Id:2 and Facili_Id:1

Course_Id:2 and Facili_Id:3

 

Now I want the SQL Commands that brings me the he "Facili_ID" and "Facili_Name"

For Course_id "For example" and should not be selected by the same course…

That would be:

 

Id:2 And Name: George

Id:3 and Name: Sam

 

And the same for eash time I pass the course_id for the command

Thank you.

 

View 10 Replies


ADVERTISEMENT

Bring Data Into SQL Server

Jul 20, 2005

I have the following tables on a non-SQL database that I can accessvia ODBC:UpdatedOrderHeaderOrderDetailsInvoiceHeaderInvoiceDetailsWhen an order or an invoice is added/updated a record with the ordernumber is added to the Updated table. I need to loop through theUpdated table and for each record bring the data over to thecorresponding tables on the SQL server.Does anyone have any ideas how to do this? I was attempting to do thiswith a DTS job, but I don't know how to pass the order number to eachupdate and then loop and get the next order.Any help would be appriciated. Let me know if you need any moreinformation.Thanks,Mike

View 1 Replies View Related

Using Membership Db To Lookup Data In Another Db And Bring Back Into A Grid View (total Newbie To .net)

May 11, 2007

I have the membership stuff up and running.  I've added a field to the membership table called custnmbr.  Once a user logs in, I want store his custnbmr in the session and use that to lookup data in another db.
ie: Joe logs in and his custnumbr is 001, he goes to the login success page and sees his list of service calls which is:
select top 10 * from svc00200 where custnmbr = 001 (the membership.custnmbr for the logged in user)
I know how to do this in old ASP using session variables....but I have no idea where to even start with .Net.
Many thanks

View 7 Replies View Related

Reporting Services :: How To Display (All Selected) When Parameter (Select All) Is Selected In SSRS

May 6, 2015

Using SSRS 2008 r2...I have a report with a single-value parameter and three multi-value parameters, Class1, Name2 and Name3. I'm hoping for an explanation to one thing that I'm seeing and information on a second thing.

Class1 and Name2 both have the (Select All) parameter selected but Class1 is displaying the concatenated parameter variable list whereas Name2 is showing Null. Why is that? If anything, how can I get Class1 to be similar to Name2 and show Null?But my desired wish is to have Class1, Name2 and Name3 display the text"All Selected" when the parameter (Select All) is chosen.

View 3 Replies View Related

SQL 2012 :: Selected Subscriber Does Not Satisfy Minimum Version Compatibility Level Of Selected Publication

Feb 21, 2014

I have created a Transactional Replication Publication on my SQL 2012 server.When I log into another server on the domain running 2008R2 and try to subscribe to the 2012 Publication, I get the following error when clicking on "Add SQL Server Subscriber": "The selected Subscriber does not satisfy the minimum version compatibility level of the selected publication"

The 2012 DB is set as 2008 Compatibility Mode?Am I not able to Publish from 2012 to 2008?.I was using SSMS 2008 to connect to my 2012 Instance, thats why it didn't work...

View 0 Replies View Related

Reporting Services :: Data Not Available For Selected Values To Be Set Based On Data Source

Jul 10, 2015

I have 4 Tablix and 2 of the Tablix get data from Server 1 and other 2 get the data from Server 2.I have set NoRowsMessage "=Data Not Available for the Selected Values"  for all the 4 Tablix.Now if data is not available from Server 1 then I must show "Data Not Available for the Selected Values" only once in the  outputbut now its appearing twice in the output because of the 2 tablix that had no rows.Similarly if data not available from Server 2 then it should show "Data Not Available for the Selected Values" only once in my output.If Data not avilable from all the Tablix then also i t should show only once as "Data Not Available for the Selected Values" in the report output.

View 3 Replies View Related

Is There Any Way To Train A Portion Of A Training Data Set From A Selected Dataset For Data Mining?

Jun 19, 2007

Hi, all experts here,



I am wondering is there any way to select only a portion of a data set to train the mining model? In this case, I mean we dont need to split the dataset in advance, what I want to do is being able to select any random portion of a selected dataset to train a mining model. Any advices?



I am looking forward to hearing from you and thanks a lot in advance for your advices and help.



With best regards,



Yours sincerely,



View 3 Replies View Related

Monitoring Inserted Data And Comparing Against Selected Data

Oct 22, 2006

I made ahuge load script in SQL Server 2000 as i load data from manytables(select some of each one collumns) into one single table and iwant to test the loaded data against the selected data to make surethat the loaded data is the same the selected datais there a code or tool to make this test or monitoring ?? pleaseurgent ....

View 2 Replies View Related

Get Data From SqlDataSource For Selected Row

Feb 24, 2007

Hello all! How can I get data from SqlDataSource for row selected in GridView?

View 3 Replies View Related

Yearly Data From Selected Range

Apr 10, 2003

Hi all,
I have the Following Query
It is working fine if the first month is 01 and Second month is 12
but i want like this if the user selects 200103 to 200203 i want the
value of composite should be added from 200103 to 200203 in one row
and other row from 200203 to 200303.
like this if the user selects from 200004 to 200304 i have to get 3 rows..
that is Yearly data..so how can i modify the following query or any new query.


select CONVERT(CHAR(4),period,112), sum(composite)
from cdh_price_gap
where CONVERT(CHAR(6),period,112) between '200101' and '200312'
group by CONVERT(CHAR(4),period,112)
order by CONVERT(CHAR(4),period,112)


Thanks

View 2 Replies View Related

Importing Selected Csv Data Into SQL Tables

Sep 6, 2007

Hi,

I hope you can help me.

I've got a csv that I need to import. It's about 74 columns wide and 2500 rows long. What I need to do is select the first 3 columns from the columns from the csv and put them into one table and then put every 7 columns (plus the 1st column as the primary key) into a different table.

I've not explained that very well, basically it's like this...

A B C D E F G H I J K L M N O P

1

2

3

4

5



Table 1 Data

cs# A1
fe B1
cl C1


Table 2

cs# A1
desc D1
date E1
pay F1
amount G1
vat H1
total I1
cReq J1

I'm not really sure were to start. I want to import the data nightly into the tables. I've tried to use the import wizard but I can't seem to select the data I want and exclude the data I don't.

Steve

View 8 Replies View Related

How To Reinitialize When There Is A Problem With Your Selected Data Store?

Nov 18, 2006

I've been trying to reinitialize the membership database, but something stops me.
I have tried deleting aspnetdb.mdf from the App_Data folder. This works fine, and then a new one is created when I use the asp.net adminstration tool. I can use the server explorer to view the table content (all null).
Although I can open the asp.net configuration page, the problem occurs when I select security. Then I get the error
There is a problem with your selected data store. This can be caused by an invalid server name or credentials, or by insufficient permission. It can also be caused by the role manager feature not being enabled. Click the button below to be redirected to a page where you can choose a new data store. The following message may help in diagnosing the problem: Database 'C:WINDOWSMicrosoft.NETFrameworkv2.0.50727asp.netwebadminfilesApp_DataASPNETDB.MDF' already exists. Could not attach file 'C:Documents and SettingsJeff LeeseMy Documentsworldmy workcurrentcounsellorApp_DataASPNETDB.MDF' as database 'ASPNETDB_devjeffleese'.
All this seems to have happened after I modified my connection info in the web.config file:
<connectionStrings>
<remove name="LocalSqlServer"/>
<add name="LocalSqlServer" connectionString="Data Source=.SQLEXPRESS;&#xD;&#xA; AttachDbFilename=|DataDirectory|ASPNETDB.MDF;&#xD;&#xA; user instance=true;&#xD;&#xA; Integrated Security=True;&#xD;&#xA; Initial Catalog=ASPNETDB_devjeffleese;"
providerName="System.Data.SqlClient" />
</connectionStrings>
So, two questions:
1) What are the &#xD;&#xA; sections about? They seem to have been inserted automatically at some point, and I wonder if its just formatting info or should I remove them?
2) How can I get security going again. How do I deal with the 'already exists' problem that prevents 'attaching' ?
Would greatly appreciate guidance in how to start over...

View 1 Replies View Related

Ntext Data Type Cannot Be Selected As DISTINCT

Mar 3, 2008

Hello,
When I am using DISTINCT in the SELECT clause for a table having a column of datatype "ntext" in SQL 2000 as well SQL 2005, it fails giving the error as "ntext data type cannot be selected as DISTINCT". This is coz
"The text, ntext, or image data type cannot be selected as DISTINCT."

But I am able to insert into a temporary table having a column whose datatype is nvarchar) using this SELECT clause in SQL 2000. Please advice me how this happens. If I am not worng, implicit conversion has happened. But this insert fails raising the same error in SQL 2005. Please help me to find the difference
thanks in advance!

View 3 Replies View Related

A Field Or Property With The Name 'Jan' Was Not Found On The Selected Data Source.

Jul 31, 2007

I have this Stored Procedure:
Create PROCEDURE ListEventas If MONTH(GetDate()) <= 6 Begin SELECT EventTitle,  EventDuration,  (CASE WHEN MONTH(StartDate) = 1 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jan',  (CASE WHEN MONTH(StartDate) = 2 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Feb',  (CASE WHEN MONTH(StartDate) = 3 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Mar',  (CASE WHEN MONTH(StartDate) = 4 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Apr',  (CASE WHEN MONTH(StartDate) = 5 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'May',  (CASE WHEN MONTH(StartDate) = 6 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jun'FROM dbo.tblEvent INNER JOIN  dbo.tbl ON (tblEvent.EventID = tblEventdate.EventID)WHERE  YEAR(StartDate) = Year(GetDate())group by EventTitle, EventDuration,StartDate,EndDateEnd Else  BeginSELECT EventTitle, EventDuration,(CASE WHEN MONTH(StartDate) = 7 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Jul',  (CASE WHEN MONTH(StartDate) = 8 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Aug',  (CASE WHEN MONTH(StartDate) = 9 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Sep',  (CASE WHEN MONTH(StartDate) = 10 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Oct',  (CASE WHEN MONTH(StartDate) = 11 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Nov',  (CASE WHEN MONTH(StartDate) = 12 THEN Datename(Day,StartDate) + ' - ' + Datename(Day,EndDate) ELSE '' END) AS 'Dec'FROM dbo.tblEvent INNER JOIN  dbo.tbl ON (tblEvent.EventID = tblEventdate.EventID)WHERE  YEAR(StartDate) = Year(GetDate())group by EventTitle, EventDuration,StartDate,EndDateEnd 
 When I execute it in the SQLExpress, the result returned as expected. But when I bind to Gridview I got this error:
A field or property with the name 'Jan' was not found on the selected data source. 
How do I solve this?  
 I am using drag and drop SQLDatasource to call the Stored Proc and VB.net is the language.  Thanks
 

View 4 Replies View Related

Copy Selected Column Data From Table To Another During Upgrade Of App

Sep 15, 2004

Hi,
I need to write a script that will be called during the database upgrade of my application. This is part of reorg of the tables. The script has to get data for say 4 columns from table A and insert it into another table B. Table B has identity insert column and remaining 4 columns matching the ones to be copied. The data is dependent on user database, hence number of records needs to be copied might be different. Also the columns can have null values.

I tried using bcp Command as follows..
bcp "select colA,colB,colC,colD from A" queryout "c: empA.dat" -t" " -r"" -c

I'm able to get the dat file, but not the format file. Can anyone tell me how to get it using query file with -c option. Also if there is better option to copy data, kindly let me know.

This is very critical. Appreciate your help.

Thanks,
Ramya.

View 3 Replies View Related

The Text Data Type Cannot Be Selected As DISTINCT Because It Is Not Comparable.

May 28, 2008

I'm having a problem building a query for an application I'm writing. Basically, there are a bunch of records in a table, and some of them may have the same identifier code. I only want one of each identifier code. The table looks like this:

Memo
---------
Msg_Identifier varchar(60)
Memo_ID int (pk)
Subject varchar(64)
Message text
Priority int
Deleted int


My query:

SELECT DISTINCT Msg_Identifier, Memo_ID, Subject, Message, Priority FROM Memo WHERE Deleted = '0'



When I run this query, I get "The text data type cannot be selected as DISTINCT because it is not comparable."

I only want Msg_Identifier to be the distinct field, and it's obviously not set up as text. I've used SELECT DISTINCT in the past but I don't ever recall hitting an issue like this. What's the best way to do it?

View 8 Replies View Related

Sql Query To Retrieve Comments Based On Selected Month And Data

Jan 4, 2008

hi,
i am generating report for my project.
my table goes like
ID   VASID     VASSID     JanMail   JanVisit    JanPhone    JanComment    FebMail   FebVisit    FebPhone   FebComment................. DecPhone  
1      25            4              True         False         False            Mail me             False       True           False            Visit me                  
 
My report has 3 check boxes for Mail,Visit,Phone respectively and a listbox of 12 months january-december respectively.. 
once user check on Mail and select a month suppose January in my report,the report should generate only January Comments.
here user can select any number of months.if user selects january,february and march, report should generate respective months Comments.
Please help me in writing SQL Query to get the comments.......
 
if any one know the solution for the above problem,Please help me
 
Thanks & Regards,
 

View 2 Replies View Related

How To Write Selected Table Data To A Text File Daily?

Aug 24, 1999

I want to check a table to see what rows have been updated today, then write to a text file some data from the selected rows; then I want to automate this (DTS package? TSQL stored procedure job?) to run every night at midnight. Is the DTS Wizard the best way, that's what I did, but have not confirmed that it is writing a new text file every day, and does each new version write over the old one?

View 1 Replies View Related

Import Excel Data From User-selected Source File

Dec 4, 2007

Is it possible to import data from an Excel spreadsheet using OPENROWSET or OPENDATASOURCE without having to explicitly define the filepath of the source file? Currently, I have this piece of code within a sproc:


INSERT INTO [dbo].[ProductionRequirementDetail]

([ProductionRequirementHeaderID], [SKU], [Quantity])

SELECT @ProductionRequirementHeaderID,

[SKU],

[LAMPS]

FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0','Excel 8.0; Database=C:WeeklySchedule.xls', 'SELECT * FROM [Master$C5:Q65536]') AS XL

LEFT JOIN [dbo].[PartMaster] ON (RIGHT([XL].[CODE], 7) = [PartMaster].[SKU])

WHERE [SKU] IS NOT NULL

AND [CODE] IS NOT NULL

AND [LAMPS] IS NOT NULL

AND [LAMPS] > 0

AND [LampTypeID] = @LampTypeID




I would like to remove the hardcoded reference 'Database=C:WeeklySchedule.xls' and replace it with a parameter for the filepath. Is this possible? This is in SQL Server 2000. Also, if there is a way to do this with DTS I'd be open to doing it that way too.

View 8 Replies View Related

How Do I Extract Data From Selected Rows From My Excel Source File?

Jun 21, 2006

The columns in my excel source contain data of different types with the column name being a string and the data in those columns being integers. Is there any way to only extract numeric data , in short I want column names to be omitted. Also the data is distributed unevenly , beggining at various rows in each column.

Thanking in advance :)

View 3 Replies View Related

How To Update Selected Columns Of A Table In SQL Server Db Using Data From A Excel File?

Apr 4, 2007

Hi,I have an Excel file with 400 rows of old values and the correspondingnew values. My table currently has 10 columns out of which 3 columnsuse the old value specified in the excel file. I need to update thoseold values in the columns with the new values from the Excel file.Please guide me as to how to proceed with this.Thanks in advance!

View 4 Replies View Related

Data Access :: Server Rejected The Connection - Access To Selected Database Has Been Denied

Jun 10, 2015

I have recently upgraded to SQL2014 on Win2012. The Access front end program works fine.

But, previously created Excel reports with built in MS Queries now fail with the above error for users with MS 2013.  The queries still work for users still using MS 2007. 

I also cannot create any new queries and get the same error message. If I log on as myself on the domain to another PC with 2007 installed it works fine, so I don't think it is anything to do with AD groups or permissions.

View 6 Replies View Related

Bring Out Your Dead!

Mar 14, 2006

It's been pretty quiet on here recently - no-one experiencing any corruption problems we haven't already given guidance on? Cool...

Paul Randal
Lead Program Manager, Microsoft SQL Server Storage Engine + SQL Express
(Legalese: This posting is provided "AS IS" with no warranties, and confers no rights.)

View 20 Replies View Related

How To Bring Out Column Names With Bcp?

Nov 20, 2007

Hello, everyone:

I used bcp to generate a txt file as:

EXEC master..xp_cmdshell 'bcp "SELECT * FROM Test..Orders" queryout "c:/test.txt " -U tester -P tester -c'

It works fine except without column names of table. Does any one have idea that can bring out column names from table?

Thanks

ZYT

View 9 Replies View Related

Bring A Table Back

Feb 25, 2004

Hello, everyone:

I have deleted a static table accidentally in production. How will I bring it back? Thanks a lot.

ZYT

View 2 Replies View Related

How Bring STAND BY To ACTIVE

Jul 15, 2006

Hi all

My management ask me use logshipping in the part of Disaster Recovery plan,as per i know i have put target database in STAND BY mode in logshipping
if ACTIVE MODE fail's how can i bring back the logshipped DB to active


Thanks in Advance
saivyshnav

saivyshnav
Junior DBA

View 9 Replies View Related

How Do I Bring Over Stored Procedures

Jul 10, 2007

Hi I'm still new to sql2005 and I wanted to copy over a database to another machine along with the stored procedures but when I do an Import using SSIS import/export wizard I only get the database and not the stored procedures. Anyone know how I can also get the stored procedures?

View 1 Replies View Related

Bring Db Online/offline

Jul 23, 2005

Hello there,I have a user who can bring offline a database but he cannot bring thedatabase back online.The error which pops up is:Error5011: User does not have permission to alter database dbnameALTER DATABASE statement failed.sp_dboption command failed.Any ideas?Thanks

View 1 Replies View Related

Client Tools, What Is It For And What Bring Us?

Jul 4, 2006

hi everyone,

Client Tools brings a BIDS platform?

TIA

View 5 Replies View Related

How Do I Bring KPI Into A SSRS Report

Apr 7, 2008

I am using SSAS to build some KPI's at the cube level itself

I want to access them through SSRS (and in the future, ProClarity)

I couldn't find any resources on how to do it?

Please help

View 1 Replies View Related

How To Bring Down A Published Report?

Mar 16, 2008

I published a report in SSRS 2005. I see the report on the SSRS home page. How do I remove the report from server and from the home page?

View 3 Replies View Related

Bring Database Online

Jul 10, 2007

Hi,

One of our database size 90 Gb was backed up and restored on a standyby server with NoRecovery option .A Stored Procedure was written to do production Database transaction log Backup every 15 min and restore the Tlog File on Standby server.



Once the last transaction log file is restored on standby server the tlog file is deleted.



Now due to some reason the restore tlog job failed but the tlog file got deleted.

Now till we will not restore the last database backup we will not be able to start the restore tlog job.

Now the database is in restoring mode.Is there any methord to get that database online without any transactionlog.



Regards

Sufian











View 4 Replies View Related

How To Bring Up Warm Stabdby Server?

Sep 25, 2007

Hello, everyone:

I am making disaster recovery plan and considering technical details. My question is that if I configure log shipping and primary server is failed. I have to bring up secondery server online. As warm standby server, the secondary server is Read-only. How to disable read-only?

Thanks

ZYT

View 3 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved