Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
  Advanced Search
  HOME    TRACKER    MS SQL Server






SuperbHosting.net have generously sponsored dedicated servers to ensure a reliable and scalable dedicated hosting solution for BigResource.com.





Does SQL Server 2005 Has Similar Function Like Mysql_fetch_row ?


I just began to use SQL Server 2005 as database programming and
found out that I have to translate mysql_fetch_row into SQL Server 2005
but I cannot find some related functions/api, and I was wondering
Does SQL Server 2005 has similar function like mysql_fetch_row ?
Or if not, any advice how I can program to acheive similar functions ?
thank you in advance.




View Complete Forum Thread with Replies
Sponsored Links:

Related Messages:
Function Similar To ISNULL()
I'm constructing a single string of several counts with concatenated labels using SQL and want to not show zeros (or their labels). Is there a function within an SQL statement that will let me do this? ISNULL() sort of does this, but I really need to test for zero instead of NULL to eliminate noise data from the string.

View Replies !   View Related
Similar To COALESCE Function
I have three fields in a table say [F1, F2 & F3]. I need to fetch anyone of these three fields which has the maximum value between them.

In Simple words i'm looking for some function which is similar to COALESCE function which returns the first NOT NULL value of the fields that were passed as arguments.

FYI I'm using SQL Server 7.0 which does not supports UDF's

Earlier response appreciated

Thanks and Regards
Chandru

View Replies !   View Related
Function To Match Similar Words
Is there a function to match simalar words
say for example 'tom' will match 'tomy'

Thanks

View Replies !   View Related
Any Function In T-SQL Thats Similar To GREATEST() IN Orcl.
 
Is there any Function in T-SQL thats similar to GREATEST() IN Orcl?
 
Iam trying to find the greatest of two DATETIME datatype Fields in my 'select's.
If there is no in built function, Whats the best approach?

View Replies !   View Related
Conditonal SUM Function, Or Similar Conditional Aggregates
Are there any conditional aggregate functions, such as SUM()?An example would probably be the best way to describe what I'mtrying to do...I have the following table, named Orders, with the following records:ItemNo qty_ord paid------ ----------- ------T101B 1 199.00T101B 1 199.00T101B 1 199.00T101B 1 199.00T101B 1 199.00T101B 1 199.00T101B 1 199.00T101B 1 0.00T101B 1 0.00T101B 1 0.00T101B 1 0.00Z200L 1 50.00Z200L 2 100.00I want to produce the following result set:ItemNo qty_gross qty_net------ ---------- -------T101B 11 7Z200L 3 3The "qty_gross" column in the result set is the sum oftotal items ordered within the ItemNo grouping.Easy enough. However, I also want a column "qty_net" thatis the sum of qty_ord but ONLY IF the amount in the"paid" column is > 0.I tried using the HAVING clause, but that produces acatch 22 situation. If I say "HAVING paid > 0" thenthe qty_gross column is wrong because it leaves out rowsthat contain records with paid = 0 values. If I leaveout the HAVING clause, then the "qty_net" is wrong.Any ideas?select ItemNo, Sum(qty_ord) as qty_gross, Sum(qty_ord) as qty_netfrom Ordersgroup by qty_ord, paid, ItemNohaving paid > 0 ?????Thanks,Robbie

View Replies !   View Related
Script / Function ... To Find Difference B/w 2 Similar Tables
Hi,I m searching for some Script / Function ... to find difference in datab/w 2 similar tables (exactly same fields structure) in sql 2000.plz update me asap !thanks in advance !

View Replies !   View Related
How To Basically Copy Tables With New Names Rather Than Create Similar Tables From Similar Manual Input.
I have a table that I am basically reduplicating a couple of times for each part of this database that I want to create.Each table basically has the same data: The tables will be called motherTable, fatherTable, sonTable, daughterTable and so on.I am pretty much using the following in each column: UserID, MotherID(or FatherID or SonID, etc., etc. and so on for each unique table), FirstName, LastName, MiddleName, BirthPlace, Photo, Age.I don't see an option to copy a table and just modify the second ID part and rename that table accordingly.How can I make this an easier way of creating these similar tables without retyping all these columns over and over again?Thanks in advance. 

View Replies !   View Related
Is There Something Similar To SQL 2005 Row_number() In Sql Mobile?
Hello,

    I am wondering if somone could provide me with a sample SELECT for an
auto number query. For example I have a table called People with two columns first_name, and last_name. There isn't a unique id to correspond with the table but would like to dynamically make one during the return of the query.

I know this is possible in the full version of sql 2005 using

SELECT ROW_NUMBER() OVER (ORDER BY last_name), first_name, last_name from People

But within sql mobile is there a way?
So if there was 5 rows in the table it would return

1    John    Alpha
2    John    Beta
3    John    Cat
4    John    Delta
5    John    Echo

John

View Replies !   View Related
ROW_NUMBER() Function Is Not Recognized In Store Procedure.(how To Add ROW_NUMBER() Function Into SQL SERVER 2005 DataBase Library )
Can anybody know ,how can we add  builtin functions(ROW_NUMBER()) of Sql Server 2005  into database library.
I get this error when i used into storeprocedure :
ROW_NUMBER() function is not recognized in store procedure.
i used MS SQL SERVER 2005 , so i think "ROW_FUNCTION()" is not in MS SQL SERVER 2005 database library.
I need to add that function into MS SQL SERVER 2005 database library.
Can anbody know how we can add that function into MS SQL SERVER 2005 database library?
 

View Replies !   View Related
Array (or Similar Thing ) In Sql Server
I would like to write a fun or stored procedure to do some operation. It require me to know that what category is currently belong to certain people(people_table: category_table1               to           Many)However, when i use the select statement in stored proc, it return a set of result, not a scalar , therefore, i cannot use the variable to hold it. In addition, there are no array in SQL server.Question:1. Is there any way to hold the collection of result(like array)?2. Also, how to determine to use fun or stored procedure?(Since a integer is need to return by them)Thx

View Replies !   View Related
How Can I Apply Transaction Log To The Other Similar SQL Server
I have two SQL 6.5 servers running independently. Both servers have almost identical databases. For example, we create purchase order in SQL server A. And post the same purchase order # for it's PO Receipt and PO Inspection in SQL server B. How can I apply all transactions entered from SQL server A to SQL server B, and vise versa at end of the day. How can I get help or training for writing codes for manipulating transaction log?

View Replies !   View Related
How To Create A Sql Server Sequence Similar To Oracle?
In oracle, I can setup a sequence generating unique ids and query the next value (which is used as a unique identifer). I know sql server has the identity field but I need to query the next val so I can insert rows into multiple tables.
When a user submits a form, I want to take the dept info from the form (in c# asp.net 2.0) and grab the first two characters. Then query the next val from a table that holds an int.. During insert into two tables it would be something like "IT100" or "SL101". But it needs to be unique.
Is there a way to setup a table in sql server similar to a sequence where I can just query the next val (or some other way?). Remember, I cant do this as identity because I need the key being inserted in other tables during form submit.
 It seems very simple but I can't seem to find an answer online that allows me to query the next val in my code then perform the multiple inserts.
Thanks in advance for any assistance you can lend on this,
dev1aspnet

View Replies !   View Related
Is There Any Data Type Uniqueidentifier (SQL Server 7.0) Similar To This In Oracle8 ?
Hai
Guys,
we have a data type called uniqueidentifier in SQL Server 7.0.It generates GUID for us and best candidate for primary key.It generates a number like this AE21B9A9-F99E-11D3-BB99-0008C79FF0A9 .This unique across any computer in the world.At present we are devloping our application in ASP,MTS,SQL Server 7.0.In future we need to migrate this SQL database to oracle8.At this point if we use this uniqueidentifier datatype in SQL server 7.0 ,do you all think in future we are going get problems while migration.

Start brain storming now.Please try to give reply ASAP.

Thanks Dudes,
Krishna

View Replies !   View Related
Connection To SQL Server Files (*.mdf) Require SQL Server Express 2005 To Function Properly.
I dont have the SQL EXPRESS installed instead I have SQL Standard Edition.
 I have two SQL Server instances installed.
 1- UserLT (this is sql 2000)2- UserLTSQL2005 (this is SQL 2005 named instance)
But when i try to add a database to my VS website project I get the following error:
Connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=4925
I went in Tools>Opetions>DataBase tools>Data Connection>Sql Server Instance Name (blank for default)
and changed the "SQLEXPRESS" to "USERLTSQL2005".
But I still get the same error message. Any ideas how i can resolve this issue?

View Replies !   View Related
Connection To SQL Server Files (*.mdf) Require SQL Server Express 2005 To Function Properly
hello,

i've installed SQL server 2005 express and Visual web developper 2005 express.

when i whant to create a database in VWD the following error occures:

connection to SQL Server files (*.mdf) require SQL server express 2005 to function properly. please verify the installation of the component or download from the URL: go.microsoft.com/fwlink/?linkId=49251

i searched the internet but can't find the solution, i already reinstalled my complete workstation but the problem stays.

please help!

View Replies !   View Related
Dont Think Discretization Function Is Necessary On The Analysis Service Server In SQL Server 2005
Hi, all here,

I am just wondering about the Discretization function available on analysis service server (which can not actually discretize data into user-defined expressions) . Isnt it redundant ? I mean since users can discretize their data  more meaningfully based on their own expressions in database engine of SQL Server 2005.

Thanks a lot.

View Replies !   View Related
VS2005 Error: Connection To SQL Server Files (*.mdf) Requires SQL Server Express 2005 To Function Properly.
 

Good Evening All,
 
I've serached this forum and Google'd for a resolution to this issue, to no avail.  Here's the scenario:
I'm running VS 2005 on Windows Media Center laptop and need to create ASP.net membership for my web application built using VB.  I have SQL Server Developer installed with instance name MSSQLSERVER.  Previously, I uninstalled SQL Express and installed Developer edition and can now open and utilize Management Studio.
 
Now, when I try to create a new SQL Server database in my solution's App_Data directory, I receive the above error.  I already changed instance name in VS2005 per Tools-Options-Database Tools-Data Connections to MSSQLSERVER. 
 
Could someone provide me with a list of procedures to ensure proper setup of VS2005 with SQL Server Developer Edition?
 
Thanks much for your help.

View Replies !   View Related
Split Function - Sql Server 2005
In my table, column1 having a comma separated values.I want to display in rowwise.
for example:
column1
aa,ss,ff
 
output should be
aa
ss
ff
 
Pls. help me..I want to do thr query.

View Replies !   View Related
Count Function: SQL Server 2005
is it possible to do a count on the same column but under different circumstances posting the results in two different result columns?
 

View Replies !   View Related
Sql Server 2005 GETDATE() Function
I have a small problem using the GETDATE() function from a JAVA program using the MS JDBC connector.

When I use the SQL Mangment Studio Express to execute this query:

SELECT GETDATE()
it returns 2008-04-22 16:25:03.690 which is OK !!

I want to get that same value using a Java program so I do that query but when I display it it shows as:

2008-04-22  and there is no time there !
I tried formatting the date to include time but it shows as: 04/22/2008 12:00:00 AM
So maybe the time isn´t there ?

This is the code i am using:

            Statement st = con.createStatement();
            String sql = "SELECT GETDATE()";
            ResultSet result1 = st.executeQuery(sql);

result1.next();

            Date today = result1.getDate(1);


Any help would be appreciated.

View Replies !   View Related
SQL Server 2005 Query With Date Function
I wrote a function and a SQL to get the  3 columns Date,Total Orders
& Amount, for dates between Date Started and Date Completed if I
pass different Dates in the SQL I get the correct result but if I pass
same dates then I don't get the result I am looking for .For Instance,if I give Date From=1/02/2008 ;Date To=1/8/2008(Different dates )I am getting values for all the three columns.But I give same dates for  Date From=01/02/2008 ;Date To=01/02/2008 then I am not getting the records.Some how I could not trace what could be the error in my SQL /Function.I appreciate if I could get some work around for this.Thanks!  Function:create function dbo.CreateDateList(@start datetime, @end datetime)returns @t table ( [date] datetime )asbegin if @start is null or @end is null return if @start > @end return set @start = convert(datetime, convert(varchar(10), @start, 120), 120) set @end = convert(datetime, convert(varchar(10), @end, 120), 120) while @start < @end begin insert into @t ( [date] ) values (@start) set @start = dateadd(day, 1, @start) end returnend ---------SELECT qUERY---------- SELECT Convert(Varchar(15), l.[date],101)as Date,COUNT(o.OrderID ) AS TotalOrders,ISNULL(Round(SUM(o.SubTotal),2),0) AS Amount , 1 as OrderByCol FROM dbo.CreateDateList(@DateFrom , @DateTo) l LEFT OUTER JOIN orders o ON o.Datecompleted >=Convert(Datetime, l.[date],101) and o.Datecompleted < dateadd(day,1,convert(Datetime, l.[date],101)) WHERE StoreID=@StoreID GROUP BY Convert(Varchar(15), l.[date],101) Union SELECT 'Grand Total' as Total,NULL AS TotalOrders, ISNULL(Round(SUM(o.SubTotal),2),0) AS Amount, 2 as OrderByCol FROM dbo.CreateDateList(@DateFrom , @DateTo) l LEFT OUTER JOIN orders o ON o.Datecompleted >=Convert(Datetime, l.[date],101) and o.Datecompleted < dateadd(day,1,convert(Datetime, l.[date],101)) WHERE StoreID=@StoreID Order by Date   

View Replies !   View Related
How To Run User Defined Function On Sql Server 2005
Dear all
I wants to run sql server user defined function when linked two server.
 
I have linked two sql server.There is one function called getenc().This function created on first server.What i want.I wants to run this user defined function on the second sql server. can any one help me?
 
Regards
Jerminxxx

View Replies !   View Related
SQL Server 2005 Query/trigger/function (whatever It Is That I Need)
Hey guys maybe you can help me out, been trying to figure this one out all day at work. I know how to use columns in a table to calculate another column in that same table. But I need to do some math on columns from a totally seperate table. Here is my scenario
 table 1 = stock table
 table 2 = Purchase order table
 in table 2 there are line items that have ordered quantities for parts that we have ordered
 in table 1 under each part number is a field for "quantity on order"
I need to compute the "quantity on order" in table 1 by summing all of the quantities in table 2 where the partnumber = the partnumber from table 1
 
quantity on order (table 1) = sum of all quantities (table 2) where the part numbers match
so for part number 516 i have this
 
table 2
poNumber             partNumber                 quantity
1                             516                             1
2                             516                             12
3                             516                             4
 
table 1
partNumber            inStock              onOrder
516                          0                        17(this is what i am trying to figure out how to compute)
 
any help on this qould be appreciated. I would like the database to automatically do this itself if at all possible.

View Replies !   View Related
EMERGENCY:rollback Function For Sql Server 2005?
is there a roll back function for sql server 2005 that would change data back to what it was before the execution of last update  query?

View Replies !   View Related
Can I Implement A File System With SQL Server Similar To Oracle Content Services?
I need to implement a file system for an application that allows me to roll back to a point in time. I can do this with either a journaling file system (Unix based such as JFS) or with a database file system such as Oracle Internet File system (now Oracle Content Services). I would MUCH prefer to use SQL Server but cannot find anything that supports this other than a 2000 ppt referencing the then up and coming SQL Server .NET File System.

The application(s) in question are older and store data in proprietary data files and need to access a local (or mapped) drive in standard form (d:programsmyprogram).

Does SQL Server 2005 or 2008 support this type of access? I have searched but cannot find anything to support this.

Thanks.
B.W.

View Replies !   View Related
How To Convert SQL Server Datetime To Oracle Timestamp (or Other Type With Similar Precision)?
In SQL Server I've created a linked server to an Oracle database.  I am trying to insert (within the context of an sql server table trigger) an SQL Server datetime to an Oracle column with similar precision.  Oracle timestamps are not compatible with sql server datetimes and I don't know how to convert the data (or if I should use a different type of column to store the data in Oracle).  I have full control over the structure of the Oracle table so I can use a different type if timestamp is not best, but I need the destination column to have at least the same precision as the sql server datetime value.  What is the easiest way to do this?

View Replies !   View Related
How To Create Assembly Function Using Dll Files In SQL Server 2005???
Hiiiiiiii all
 
I have to make a user defined function in c# as the class liberary and create a dll file, now i want to use this function in SQL Server 2005 as a part of CLR Integration
 
I have tried like this
 

CREATE ASSEMBLY abc
FROM 'C:abc.dll'

WITH PERMISSION_SET = SAFE
 
but it gives me
incorrect syntax error 
so plzzzzz anyone help me wht to do in my probbbbbbbbb???????
 
Pratik Kansara

View Replies !   View Related
How To Read CSV File In SQL Server 2005 Using OpenRowSet Function
Hi

i want to access a CSV file using OpenRowSet function in SQL Server 2005.

 

Anyone having any idea; would be of great help.

Regards,

Salman Shehbaz.

View Replies !   View Related
SQL Server 2005 SELECT MAX Function For Multiple Columns On The Same Record
Hello,
 
I am trying to figure out how to use the select maximum command in SQL Server 2005.  I have already created a database and I have it populate it with multiple fields and multiple records.  I Would like to create a new column or field which contains the maximum value from four of the fields.  I have already created a column and I am trying to figure out how to use a command or SQL statement which is entered into the computed equation or formula in the properties for this field/column. 
 
Any help you can provide will be greatly appreciated!
 
Thank you,
Nathan

View Replies !   View Related
ODBC Link From Access To SQL Server 2005 Stored Function
If I define a table-valued function in a SQL Server 2005 database, can I link to it from Access 2003 using ODBC?

I've defined the function successfully, and I can link from Access to tables in the database (so my ODBC link is basically functioning), but I can't see the table-valued function in the Linked Table Manager in Access.

I can define a pass-through query to grab the table, but with a pass-through query I have to provide the ODBC password every time.

What am I missing?

Suggestions?

View Replies !   View Related
How To Group Similar Column Name And Sum The Similar Column Name Together
Hey Gurus,

I have a problem on getting the sql statement which will group similar column name and sum their number together(another column).


A million thanks in advance.

View Replies !   View Related
Problem With (SQL Server 2005) Reporting Services Drill Through Using SWITCH Function In Sharepoint Integration Mode
When deploying reports to a report server in Sharepoint Integration mode (post SQL 2005 SP2), when using the SWITCH function when drilling through to another report ('jump to report'), you have to append the ".rdl" entension to the report name.

 

For example, on a report server in native mode, the following will work:

 

=SWITCH(Fields!Region.Value="US","USRegionDrillDownReport",

                   Fields!Region.Value="Europe","EURegionDrillDownReport")

 

When deploying to a report server in Sharepoint Integration mode, you must do the following:

 

=SWITCH(Fields!Region.Value="US","USRegionDrillDownReport.rdl",

                   Fields!Region.Value="Europe","EURegionDrillDownReport.rdl")

 

When doing this, the deployed report will work, but the link in the Visual Studio developer environment will no longer work (and vice versa).

View Replies !   View Related
SQL Server 2005 &&"lag&&" Function
 

Hello,
 
Does SQL Server 2005 have anything like a "lag" function that, in a sigle query allow you to retrive a previous record? The syntax would be like:
 
SELECT
transactionid
,transactiondatetime
,amount
,amount + LAG(amount) OVER(ORDER BY transactiondatetime) balance
FROM
bankaccount

 
Thanks for any advice

View Replies !   View Related
Similar To PhpMyAdmin For MS Sql?
Is there any program similar to phpMyAdmin for MS SQL servers?

Thanks in advance

View Replies !   View Related
Do I Need DatePart Or Similar
I have a function that uses the following statement in it

SELECT     src_terrier.Areacode, src_terrier.siteref, src_terrier.estatename, src_terrier.Securitised, src_terrier.unitref, src_terrier.unittype,
                      src_terrier.unittype_count, src_terrier.tenantname, src_terrier.tenantstatus, src_terrier.tenantstatus_count, src_terrier.unitstatus,
                      src_terrier.unitstatus_count, src_terrier.floortotal, src_terrier.floortotocc, src_terrier.initialvacarea, src_terrier.initialvacnet, src_terrier.TotalRent,
                      src_terrier.NetRent, src_terrier.FinalRtLsincSC, src_terrier.ErvTot, src_terrier.tenancyterm, src_terrier.landact, src_terrier.datadate,
                      src_div_mgr.div_mgr, src_portfolio_mgr.portfolio_mgr, src_centre_list.propcat, src_tbl_rental.budgeted_net_rent,
                      src_tbl_rental.budgeted_occupancy
FROM         src_terrier INNER JOIN
                      src_centre_list ON src_terrier.siteref = src_centre_list.Site_Ref AND src_terrier.Areacode = src_centre_list.Division INNER JOIN
                      src_div_mgr ON src_centre_list.Division = src_div_mgr.division INNER JOIN
                      src_portfolio_mgr ON src_centre_list.Portfolio_no = src_portfolio_mgr.portfolio_no LEFT OUTER JOIN
                      src_tbl_rental ON src_terrier.siteref = src_tbl_rental.site_ref

WHERE   (src_terrier.datadate = @dt_src_date) AND
    (src_terrier.Areacode = @chr_div) AND
    (src_centre_list.Portfolio_no = @vch_portfolio_no) AND
    (src_centre_list.propcat = @vch_prop_cat) AND
    (src_tbl_rental.site_ref = src_terrier.siteref)

The problem I have is that the 'src_terrier.datadate' is passed through as mm/dd/yyyy (which I do actually want to change to dd/mm/yyyy as that is how the data is stored) however, the src_date within the table src_tbl_rental is only set to 01/mm/yyyy. When I put an inner join on the date element it obviously does not find it as the sample data I am using is as follows

src_terrier = 28/04/2006 and src_tbl_rental is 01/04/2006. Therefore if I pass the same parameter value through the dates are not the same and I get no data at all.

How can I specify that for the purposes of the src_tbl_rental element of the select query, that I only want it to match the mm/yyyy part of the src_date.

Therefore if some passes in
28/04.2006 it will get the records from the terrier table that match that date, and only the records from rental that match the 04/2006 part of the date.

Anybody confused by that , cause I am!

Regards

View Replies !   View Related
Is There St Similar To Directoryinfo In RS?
hello there.

is there any case for getting the directory/file structure on the ReportServer?
something similar to "DirectoryInfo".

i'm using the webservice
best would be putting the url (e.g. "http://localhos/reportserver/reportgroup1") to a function and get at least an array of filenames in this folder back.

is there any way to solve this?

thanks in advance, tobias

View Replies !   View Related
Sys.sql_dependencies Or Similar?
Hi!
I'm about to write some code that generate TSQLdoc.
For that I would like to show dependencies.
 
What will the best way to get actual info about
which procedures use this proc
which procedures or functions do this proc or func use?
 
 
Thanks

View Replies !   View Related
Add Similar Fields To Many Tables
Folks, i have to create four fields in every user table within my database:

CREATED_BY VARCHAR(25), CREATED_DATE [DATETIME], MODIFIED_BY VARCHAR(25), MODIFIED_DATE [DATETIME]

There are more than hundred tables, so i wanna automate this. i am tryin to do this in a cursor: please guide!

declare @name VARCHAR (50)
declare cur cursor
fast_forward
for select name from sysobjects where type='u' and status not like '-%'
open cur
WHILE (1=1)
BEGIN
FETCH NEXT
FROM cur
INTO @name
IF @@fetch_status = 0
BEGIN
ALTER TABLE @name
ADD created_by [VARCHAR] (25)
GO
ALTER TABLE @name
ADD created_by [VARCHAR] (25)
GO
ALTER TABLE @name
ADD created_date [DATETIME]
GO
ALTER TABLE @name
ADD modified_by [VARCHAR] (25)
GO
ALTER TABLE @name
ADD modified_date [DATETIME]
END
ELSE
BREAK
END
DEALLOCATE cur


I also want that if one column for a table exists; the other columns should be created rather than it quits.


Howdy!

View Replies !   View Related
Similar To Statspack/AWR Report
Is there anything similar to AWR/statspack report in SQL Server 2005.

View Replies !   View Related
Difference Between Two Similar Queries
Hi All,

Is there any difference between the two queries given below..I am not able to find any but am not sure. Kindly help.

A)

select a.* from( select top 1 hs.last_modified, hs.price, hs.revision_date
from history hs where hs.last_modified < '06-Jan-2008' order by hs.last_modified desc)a
order by a.revision_date desc

B)
select hs.last_modified, hs.price, hs.revision_date
from history hs where hs.last_modified < '06-Jan-2008'
order by hs.last_modified desc, hs.revision_date desc




Thanks,
Pradeep.D

View Replies !   View Related
Getting Data From Similar Tables...
I'm working on a program that takes in daily equipment reports. If there's a problem, the user is allowed to enter information about a problem, and then then that problem is marked as open. Users at the administration level can go in and close problems.

For this database, I have three main tables: Reports, OpenJobs, and ClosedJobs. Reports holds the regular information from an equipment report, OpenJobs holds each item that has a problem, and ClosedJobs holds rows that were in OpenJobs, but are complete. OpenJobs and ClosedJobs refer to Reports by the unique ID number in Report.

Right now I'm working on the page that allows a user to view a report. I want to show the checklist and all open and closed jobs. The checklist is coming up fine, but the open and closed jobs are being problematic.

Right now, my databases only have test values- I'm trying to get a row from Report with the id 40 currently. There are five or so rows in OpenJobs that reference that Report, and no jobs in ClosedJobs. (In fact, ClosedJobs is empty.)

Here's the query I'm using:

Code:

SELECT *
FROM ClosedJobs, OpenJobs
WHERE OpenJobs.reportID = #id# OR ClosedJobs.reportID = #id#


This query returns no rows. If I take away the ClosedJobs stuff, it works fine. If I do a "ClosedJobs Right Join OpenJobs", it works fine, but I know that I'll have a problem if I have ClosedJobs and no OpenJobs.

I want to be able to pull rows from one table, even if the other has no results. What am I doing wrong?

(Now that I think about it, I'm not sure why I have these as two tables instead of just adding a "Status" column. Let's just run with what I have for now...)

EDIT: Disregard... I thought about it and there really is no reason to have them seperate. Thanks.

View Replies !   View Related
Using Somthing Similar Than Squence In Ms Sql
Hi,
I need something like a sequence in a datafield of my table. (unique number in the table) is a uniqueidentifier the right thing to choose? and if yes, how to I insert a new value into the that table:

a) from the SQL Enterprise Manager?
b) from a JAVA program using jdbc?

thanks for all hints.

View Replies !   View Related
Queueing Similar Requests
In my service broker implementation I have defined a Host Service and a target service (both of which are stored procs) on the same DB. External applications call the Host Service Procedure (& place a request). Based on the nature of the request, the host proc triggers the target service proc (using Internal activation) & extracts some data. Say an external application App1 places a Request for Data Element A, the target procdure is triggered and it starts extracting data A. What I want is that, if another application App2 also places a request for the same data element A (while A is being extracted for App1), I should queue his request...and after the extraction (triggered by App1) is complete, I notify both App1 & App2 that their requests are complete (instead of re-extracting the data for App2). What could be the best way to handle this? Appreciate inputs here. -Thanks, Manmeet

View Replies !   View Related
How To Go About Adding Similar Tables?
I have a table that I am basically reduplicating a couple of times for each part of this database that I want to create.

Each table basically has the same data: The tables will be called motherTable, fatherTable, sonTable, daughterTable and so on.

I am pretty much using the following in each column: UserID, MotherID(or FatherID or SonID, etc., etc. and so on for each unique table), FirstName, LastName, MiddleName, BirthPlace, Photo, Age.

I don't see an option to copy a table and just modify the second ID part and rename that table accordingly.

How can I make this an easier way of creating these similar tables without retyping all these columns over and over again?

Thanks in advance.
 

View Replies !   View Related
Find Out Similar Columns
i like to write a sql query to find out similar columns in different tables.

i have something like this. but my logic is wrong.

select *
from information_schema.columns a
join information_schema.columns b
on a.column_name = b.column_name
and a.table_name <> b.table_name

View Replies !   View Related

Copyright © 2005-08 www.BigResource.com, All rights reserved