Retreiving Records If The Ff. Field Is On A List..

Jun 23, 2008

hello dudes. i've got the following table:


table name: assassins

fields:
assassinid int, identity, primary key
assassinname nvarchar
assassincallsign nvarchar
knifekills int
sniperkills int
stealthkills int
fibergarotekills int


sample data:
1, Dana White, tapout, 12, 0, 12, 1
2, Chuck Liddell, iceman, 30, 0, 0, 2
3, Timothy Oliphant, FortySeven, 100, 20, 150, 30

supposed i want to retreive only those records whose type of kills is on a given list, how do i do that? the list is actually dynamic since the kill types is actually coming from a checkbox on my page:
[] Knife Kills
[] Sniper Kills
[] Stealth Kills
[] Fibergarrote Kills

supposed i will only check Knife Kills, it will only retreive those records whose knifekills > 0

or if i check Snipers Kills and Stealth Kills, then those records whose sniperkills and stealthkills is > 0.

any of you know how to do that?

U + U + D + D + L + R + L + R + Sel + Start...

View 12 Replies


ADVERTISEMENT

Retreiving Autoincrement Field In SQL Server

Aug 1, 2006

Hi, im trying to insert values into 2 different tables. The primary key in the first table is an auto increment field, which is then the foreign key in the 2nd table.Is there any way to retrieve the autogenerated value before performing the second insert. I have done some searching on the matter, but to no avail.I tried using LAST_INSERT_ID() but i get the error message that it is not a recognized function name. The other option is using @@identity but i cant see how to put that into my SQL statement.Can anyone help please.Thanks in advanceGareth

View 2 Replies View Related

How To List The Records Of A Select

Nov 14, 2005

Hi world,Normally we receive the results of a query in several or thousands of rows. Select * From Clients-------------------------Row1. Client1Row2. Client2....Which is the the way to have everything on the same row separated by commas?Row1. Client1, Client2...thxDavid

View 1 Replies View Related

Field List Disappearing

Mar 18, 2008


I'm trying to modify an existing report. But if I make any change at all to the query (anything at all, like add a space), when I switch to the layout tab, the list of fields in the field list disappears. Un-doing the change does not restore the field list. The query runs fine from the data tab and returns a valid resultset.

Any suggestions?

This is with RS 2000 and Visual Studio 2003. Specifically, I'm trying to modify the Sales Pipeline Detail report from CRM.

Mike G.

View 1 Replies View Related

Syntax To Add Records If Primary Key = List

Sep 21, 2005

I am new to SQL administration.[color=blue]>From a list of IDs that are the primary key in one table (i.e. Customer[/color]Table), I want to make changes in tables that use those IDs as aforeign key.Basically I want to say:If fk_ID is in list [1,2,3,4,5] thendo these statements to that recordEnd ifWhere do I begin?Thanks for help with this low-level view of SQL programming.-tom

View 8 Replies View Related

Return Only The Rows From A List That Has The Same Value From One Field

Aug 2, 2006

I am in need of help to develop a query
I have two tables Exams and Exams_lab, that are joined by a field id_exame. I want to return The Exams that has all the dependent rows in Exames_lab with the same value in the status_int field of Exames_lab. Can anyone Help Me?
Lets see an example
tb_exame



id_exame
date_exame

1
07/01/2006

2
08/01/2006

3
09/01/2006
tb_exame_lab



id_exame_lab
id_exame
desc_exame
status_exame

1
1
NORMAL
1

2
1

0

3
2
NORMAL
1

4
2
PROBLEMS
1

5
2
OK
1

6
3
OK
0
in this exemple my query must return only id_exame 2 and 3 because id_exame 1 has two different values on id_status on tb_exame_lab
can anyone help me?
 

View 5 Replies View Related

How To Strip A List Of Characters From A Field

Nov 8, 2001

hey,
what the best way of stripping out a list of characters from a specified field in a table. e.g If first name consists of ABCD'E-FSA, we wnat to strip the ' and the -. There is about 15-20 characters like that.
what's the best way of doing it other encapsulating in the replace function that many times.
thanks
zoey

View 2 Replies View Related

Control Source Field As Value List

Nov 22, 2005

Hi!
I have a strored proc which adds up fields separated by semicolon into a new one and I'd like to use it as a combo box's control source field as a Value list. But it's just insert the whole field into one line like value1;value2;value3 .
Is there any way to get these values selectable in the combo box?

Thanks in advance for any help.

Vill

View 1 Replies View Related

Field List From A Stored Procedure

Apr 16, 2004

I am writing a utility that creates Java code to access a database. I am looking for a way to get a list of fields and types that are returned by an sproc. Is there any easy way to get this from the master? Do you need to parse the SQL? This list would be like what Visual Studio.NET shows, or interdev if I remember correctly.

Thanks,

Larry

View 5 Replies View Related

Populate DB Field From List In “storage� DB

Aug 10, 2006

I am fairly new to SQL programming and would like to see if you can provide me with some direction on a small project I would like to accomplish. I have experience working with databases (mainly in with different versions of FoxPro) and reporting with Crystal reports, etc. but not much with SQL.

The project that I would like to work on has 2 SQL DBs and entails looking in a database for empty CLASSCODE fields, populate these fields from a “storage� database that contains un-used CLASSCODE codes and delete the assigned codes from the storage DB or mark them as used possibly the book code.

The main DB called books has the following relevant fields, bookid, bookname, CLASSCODE (besides a number of other fields which are irrelevant to what I need to do). The “storage DB called classcode has 3 fields, CLASSCODE, Used (single character intended to contain either a Y or NULL) and date assigned. The original idea was to put a Y in the used field and insert the date the code was assigned to a book, but this is not entirely necessary, we have 90k unused codes and it really does not matter if they are simply deleted from the DB.

My idea is to create a script to accomplish this that I can run periodically when new books have been added to the DB. I can setup the update routine (something like the list below) but what I am stuck with is trying to do the following:

Pick the first record (classcode) from the classcode DB
Go to the books DB and update it with this classcode
Go back to the classcode DB and mark the used record with a Y in the Used field
Loop though the books DB and perform the same operation until no more records exist with an empty classcode field.

I will greatly appreciate your feedback you can provide.

Mike.

UPDATE [dbo].[Books]
SET dbo.Books.Classcode = [dbo].[classcode].[classcode]
From dbo.classcode
On [dbo].[Books].[classcode]= [NULL]

Populate DB field from list in “storage� DB


Mike Campos - CA

View 2 Replies View Related

Transact SQL :: List All Available Values Of A Field?

Aug 10, 2015

I have [TableAccount.AccountType] field which can store these values:

Value
C
S
E

How do I list all available values for a field?  Using Distinct can only list all entries in the db, but does not list all values available for the field.

View 4 Replies View Related

MSSQL Query To List Out Unique Records

May 22, 2008

 hilet me explain my need..following are the tables im using..tbl_company (company table - parent)    id    company    1    test    2    test123    tbl_dept (department table - master)    id    dept    1    dept1    2    dept2tbl_compdept (company departments table - child)    cmpid    deptid    1            1    2            1    2            2    wats my need is.. while the company is listing..by query using joins, result was like this..company        depttest                dept1test123           dept1test123           dept2i need company test123 should be listd only once..when i use group by or distinct means, all r listed..is there any way to filter out therepeating company list by just listing the company list only once..

View 5 Replies View Related

Append String To Field Value In Select List

Jul 26, 2004

How can I append a string to the field value in the select list


SELECT Code + '-20' FROM tb.....

I want to the above to return 2000-20 for example.

How can I do this?

Mike B

View 1 Replies View Related

Unknown Column 'state' In Field List

Feb 25, 2006

I installed a script that is suppose to accept paypal, however on trying totest a payment, I get this error msg:ErrorDatabase access errorand I get this error msg emailed to me:Unknown column 'State' in 'field list'Query: 'INSERT INTO `TransactionsMembership` (ID, Sum, State ) VALUESwhat could be swrong, importantly how do I fix it?

View 2 Replies View Related

Power Pivot :: Field List Does Not Refresh

May 31, 2015

I am having issues where the PowerPivot Field List does not refresh once I add a new table/field then select Refresh All under Data. I have to refresh every single PowerPivot Field List so they are all refreshed. ("PowerPivot data was modified" message). This doesn't happen at first but once the model is built on it tends to happen.I'm on Excel 2010 PowerPivot 2012 SP2 32bit. I have Windows 7 64bit and I'm wondering if the bitness inconsistency is an issue.

View 3 Replies View Related

DB Design :: Update List Of Records In A Table With New Value Depending On Old Value

Jun 15, 2015

I have a table called acc1152 with the field accno. depending on what the value of this field is, i need to replace it with a new value. These are the values i need to update

old value new value
7007 4007
7008 4008
4008 7
7009 4009
7011 4011
4011 ' '
7010 4010
4010 1
7016 4016
4016 1
4506 4006
4512 4012

how do I write one query that will accomplish this?

View 3 Replies View Related

Error 1052 - Column In Field List Is Ambiguous

Aug 7, 2014

I am trying to get a country name out of my database:

I have 3 tables

classified_jobs
classified_job_destinations
destination_old

I am trying to join the 3 as follows:

select DISTINCT destination_id, classified_job_id from classified_job_destinations inner join classified_jobs
on classified_jobs.classified_jobs_id = classified_jobs.classified_job_id
LEFT JOIN destinations_old
ON destinations_old.destination_id = classified_job_destinations.destination_id WHERE classified_jobs.classified_jobs_id = '438'

but I am getting the error: #1052 - Column 'destination_id' in field list is ambiguous

View 7 Replies View Related

How To View Field List On The Left Side Of Report Layout

Jan 4, 2007

I want to see all the fields list on the left side of report layout, you can drag a field and put it on the report.

Thank you very much.

View 5 Replies View Related

How Do You Parse A Single Field List Of Values Separated By Comma?

Jan 3, 2008


IE:
ID ContactID

1 4, 5, 6, 8
2 3,4,6

Someone coded their database like this. It is a SQL server table with these two fields.
How do I use SSIS to parse out that single field?

View 5 Replies View Related

Transact SQL :: Get Query By Selecting Month From Dropdown List And Display Records?

Oct 8, 2015

Im trying to get query by selecting the month from dropdownlist and display the records .by using the below query I need to enter the date in tecxtboc then it will show the output

select Standard, Total, MonthName
from (SELECT Standard, COUNT(Standard) AS Total,
datename(month, ReportDate) as [MonthName]
FROM CPTable where
ReportDate >= @ReportDate

[Code] .....

View 5 Replies View Related

Retreiving Specific Row.

Jul 13, 2004

SQL question here:
I am setting up a blog, and I would like the data list to default to the most recent post ONLY. How would I define the filter to get the most recent post?
I have a publishing date in my table, and I can sort the post, but I have no clue how to select just one row to display.

I can get it to work by adding a dropdown list the is bound to the publishing date column, then retreving the post based on the control, but I don't want to use the control. (Making the control not visible is not an option.

View 2 Replies View Related

SQL Server 2008 :: Turn Field Values Into Comma Separated List

Aug 11, 2015

I have about 100 K records of the form below in Example 1 and I would like to turn them into the form of Example 2, basically turn the entries in field2 into a coma separated list of values sorted by field1.

Example 1:

field1_field2
1_____a
1_____b
1_____c
2_____f
2_____g

and I would like to get it in the form

Example 2:

field1_field3
1_____a,b,c
2_____f,g

View 2 Replies View Related

Debug Stored Procedure That Uses Comma Delimited List To Insert Multiple Records

Jan 18, 2006

I need some help with a stored procedure to insert multiple rows into a join table from a checkboxlist on a form. The database structure has 3 tables - Products, Files, and ProductFiles(join). From a asp.net formview users are able to upload files to the server. The formview has a products checkboxlist where the user selects all products a file they are uploading applies too. I parse the selected values of the checkboxlist into a comma delimited list that is then passed with other parameters to the stored proc. If only one value is selected in the checkboxlist then the spproc executed correctly. Also, if i run sql profiler i can confirm that the that asp.net is passing the correct information to the sproc:
exec proc_Add_Product_Files @FileName = N'This is just a test.doc', @FileDescription = N'test', @FileSize = 24064, @LanguageID = NULL, @DocumentCategoryID = 1, @ComplianceID = NULL, @SubmittedBy = N'Kevin McPhail', @SubmittedDate = 'Jan 18 2006 12:00:00:000AM', @ProductID = N'10,11,8'
Here is the stored proc it is based on an article posted in another newsgroup on handling lists in a stored proc. Obviously there was something in the article i did not understand correctly or the author left something out that most people probably already know (I am fairly new to stored procs)
CREATE PROCEDURE proc_Add_Product_Files_v2/*Declare variables for the stored procedure. ProductID is a varchar because it will receive a comma,delimited list of values from the webform and then insert a rowinto productfiles for each product that the file being uploaded pertains to. */@FileName varchar(150),@FileDescription varchar(150),@FileSize int,@LanguageID int,@DocumentCategoryID int,@ComplianceID int,@SubmittedBy varchar(50),@SubmittedDate datetime,@ProductID varchar(150)
ASBEGIN
  DECLARE @FileID INT
 SET NOCOUNT ON
/*Insert into the files table and retrieve the primary key of the new record using @@identity*/ INSERT INTO Files (FileName, FileDescription, FileSize, LanguageID, DocumentCategoryID, ComplianceID, SubmittedBy, SubmittedDate) Values (@FileName, @FileDescription, @FileSize, @LanguageID, @DocumentCategoryID, @ComplianceID, @SubmittedBy, @SubmittedDate)
 Select @FileID=@@Identity
/*Uses dynamic sql to insert the comma delimited list of productids into the productfiles table.*/ DECLARE @ProductFilesInsert varchar(2000)
 SET @ProductFilesInsert = 'INSERT INTO ProductFiles (FileID, ProductID) SELECT  ' + CONVERT(varchar,@FileID) + ', Product1ID FROM Products WHERE Product1ID IN (' + @ProductID + ')'  exec(@ProductFilesInsert) EndGO
 
 

View 4 Replies View Related

Retreiving Table Information With SQL

Mar 5, 2004

Hello:

I have an app that needs to retrieve the list of tables in an SQL database. I see that there is a way to do this with the OLEdb provider (GetOleDbSchemaTable() ), but I can't find a sibling method in SQL. IS there one/ Any Ideas?

Mike

View 4 Replies View Related

Storing/retreiving Images In Sql - Need Help - Possible???

Sep 21, 2004

I am storing images within and image field in sql, however when I go to get the data I have two issues.

the first issue is that my image is linked to information on another table but the only way that i have seen getting the image back is to do a:

response.binarywrite(mydatareader.item("image"))

but i am hoping to be able to find a way to use the template functionality with datagrid to align the picture with the information on the table. i am storing the image type and size with the image as well.

the second problem might be related to the load, i am not sure. sometimes, for some images and it just shows the frame of the image with the red x in the middle. The load appears to work (no errors) but since we cannot view them properly we dont know.

Our application wants to store all data in sql so that we can secure it and relate it to projects. in addition, we hope to be able to use this function to upload all sorts of binary documents from jpg, gif, doc, xls, visio, and others as we can. any issues with that process???

we would like to be able to display them directly in the browser where we can but all users have standard office.

any suggestions on either and hopefully both of these situations? we have sort of hit a brick wall.

View 4 Replies View Related

Inserting/retreiving Audio... Please, Please Help

Dec 21, 2005

hi. I am at a new stage in our project and need to figure out how to insert/retreive MP3/Wav files. The way we want to do this is have the file stored on the harddrive while a link to its location is stored in the database.

I have posted this search in other newsgroups and have gotten a lot of philosophical responses, but what i really am looking for is code examples. Please, what i would like to see is "how" this id done in code. If you have done this on your site, i'd really appreciate your posting code here or emailing me examples. Or, if you know of a really good explainaition of how to go about storing/retreiving audio files in the way i mentioned using MS SQL Sever 2000, I'd be equally indebted.

I hope I have explained myself clearly. Thank you for your assistance!

have a peaceful day.

View 4 Replies View Related

Retreiving Dts Package From Backup?

Dec 13, 2004

Last week I discovered a server runing a sql database for a vendor application. Last year sometime one of our former employees created a dts to populate some data in peoplesoft from this database. But, over this last weekend, the vendor came in and uninstalled and reinstalled sql server and only restored their specific database. All I have is backups of msdb and master and I'm not sure how to restore our dts package. Any clues would be appreciated.

View 4 Replies View Related

Retreiving Lost Data

Jan 29, 2005

I Somehow restored the latest database onto the test database. Can I now retrieve the lost data. If Yes , How is it possible.

Akash

View 2 Replies View Related

Retreiving Duplicates From A Database

Apr 12, 2008

How would I get three fields out of the database if they are duplicates?

I got it to work with one field but can't get it to work with the other two fields (BIC and PaymentAmt)

SELECT Claim,
COUNT(Claim) AS NumOccurrences
FROM Info
GROUP BY Claim
HAVING ( COUNT(claim) > 1 )

View 4 Replies View Related

Help In Retreiving Multiple HeadCount

Sep 28, 2007

Hi all
I have the following table schema and their details as follows:

Code Block
CREATE TABLE #Tbl_Project
(
ID varchar(40),
Name varchar(50)
)
GO
CREATE TABLE #Tbl_User_Project
(
ID int,
ProjectID varchar(40),
Role varchar(20)
)
GO
INSERT INTO #Tbl_Project VALUES('PRJ1','Project 1')
INSERT INTO #Tbl_Project VALUES('PRJ2','Project 2')
INSERT INTO #Tbl_Project VALUES('PRJ3','Project 3')
GO
INSERT INTO #Tbl_User_Project VALUES(1,'PRJ1','PM')
INSERT INTO #Tbl_User_Project VALUES(2,'PRJ1','TL')
INSERT INTO #Tbl_User_Project VALUES(3,'PRJ1','TM')
INSERT INTO #Tbl_User_Project VALUES(4,'PRJ2','PM')
INSERT INTO #Tbl_User_Project VALUES(5,'PRJ2','TL')
INSERT INTO #Tbl_User_Project VALUES(6,'PRJ3','PM')
INSERT INTO #Tbl_User_Project VALUES(7,'PRJ3','TL')
INSERT INTO #Tbl_User_Project VALUES(8,'PRJ3','TL')
GO
--Required Output
--ProjectID ProjectName PM:TL:TM Ratio HeadCount
--PRJ1 Project 1 1:1:1 3
--PRJ2 Project 2 1:0:1 2
--PRJ3 Project 3 1:0:2 3
DROP TABLE #Tbl_Project,#Tbl_User_Project

This is just sample of the values. The ratio obtained should be as follows:
Assuming for a Project 1 there are 2 - PM's , 6-TL's , 15 - TM's then the ratio should be 1:3:7.5 . So please help me in this regard.

View 5 Replies View Related

Retreiving Values From The Same Column

Sep 23, 2007

Hi every one,

I have a serious problem struggling with sql query the problem is i have a table below

Sno CarId carcharacterstics Charactersticvalue

1. Mercides01 Color Red
2. Mercides01 EngineType Desile
3. Mercides01 Speed/Hr 350KM
4. Maruthi01 Color Red
5. Maruthi01 EngineType Desile
6. Maruthi01 Speed/Hr 250KM
7. BMW Gears Automatic
8. BMW EngineType Desile
9. BMW Speed/Hr 250KM


Now i need to retrieve the carid whose color is red and Engine type is desile the query i have written is

select carid from carchar where ((characterstics='Color' and charactersticvalue=Red) and (characterstics='EngineType' and charactersticvalue=Desile))

But I am not able to retrieve the values. I can retrieve the values correctly if i mention only one characterstics and its value but i cant retrieve if i mention more than that

View 3 Replies View Related

SQLDMO Retreiving The ListInsstalledInstances For 64 BIT SQL Server

Apr 17, 2008



We are having a Windows Installer Program (32 bit) which calls the SQLDMO to get the list of installed instances in a 64 bit 2005 sql server machine. This fails as the windows installer tries opens up the 32 bit sqldmo and there is no instance of 32 bit sql server on this machine.
Is there any way by which sqldmo can return all 64 bit sql server instance when called from a 32 bit Application?

Regards,
Ashish

View 4 Replies View Related

Retreiving TranLog Filenames From Windows Directory

Jan 24, 2006

Due to circumstances beyond my control, I have to restore a full database backup from October 1, 2005 and then over 4400 transaction logs to bring a database up to Jan 01, 2006 on a development server (storage team lost all daily full backups from 10/02/2005 to 01/01/2006). Since the backups were not taken on this machine originally, the information I would pull from the sysjobhistory tables to get the transaction backup names is not available. Does anyone have a link or a script to pull the filenames from the backup directory into sql server so I can build a dynamic script to apply the tran logs instead of running all 4400+ of them by hand? Thanks, Tom

View 5 Replies View Related







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