Top N By Group -- Returning Additional Fields

Feb 18, 2008



I am looking to sum the dollar amounts spent by customer for their last five visits (actually looking for avg. spend in the last five trips).

So we are dealing with three fields: CustID, Date, Cost

I've had to do it the HARD way -- Crystal Report with running total fields numbering the five most recent trips (essentially rowID by group) and summing the $ figure; export to Access the entire report (1,000,000 records), and delete every record where the running rowID <> 5

There has to be a straightforward way to do this.


Any Top N query I've seen doesn't seem to be able to return a field other than the one sorting on. This is most annoying.

View 9 Replies


ADVERTISEMENT

Adding Additional Fields To ASPNETDB.mdf

Dec 28, 2006

I am attempting to add additional fields and data to the default users database that is created as a result of enabling roles on my website.  Is it possible to add additional data fields to this file?  Where can I find the commands to do this?

View 2 Replies View Related

SQL Server 2012 :: Joining Table To Itself To Get Most Recent Date As Well As Additional Fields

Mar 11, 2014

I am querying a table log file in an attempt to get the most recent status of an item. The items can have a variety of different statuses:

(A = Active, R = Repeat, L = liquidation......)

Here is a sample of the data I am trying to report off of:

CREATE TABLE [dbo].[item_status](
[item_number] [varchar](20) NULL,
[sku] [varchar](100) NULL,
[Field_Name] [varchar](50) NULL,
[Old_Value] [varchar](150) NULL,
[New_Value] [varchar](150) NULL,
[Change_Date] [smalldatetime] NULL
) ON [PRIMARY]

[code]...

I have tried join to the same table - but I am still unable to get it to work.

View 1 Replies View Related

SQL Server Admin 2014 :: Creating Additional Data File For A Particular File Group?

Jul 6, 2015

For a database, we have 4 data files in a particular file group and the file sizes are almost 70 GB each.

Do I come across any performance issues if I create/pre-allocate an additional data file in the same file group so that the existing files don't grow too much?

View 5 Replies View Related

Returning All Fields From Any Table Name Passed .

Nov 30, 1998

I am trying to created a stored procedure/query to return all fields from any of my 43 look-up tables in my database. I have all of my look-up table names listed in a VB grid. I want the user to select a particular table, click edit (which pass's the table name) and have one stored procdure return all of the field in the table and populate them in a second VB form with the fields listed in a new grid.


Can one pass the "SQL string" to excute/ create a temp table.... A regular SP requires a specife table name to query from. Is there a way to do this without creating a temp table

Thanks for the help
EM.

View 2 Replies View Related

Evaluating 2 Fields And Returning The Larger

May 22, 2007

I have two int fields in my database, CEOAnnualBonus and CEOBonus, and I want to return the value of whichever one has the larger value as CEOBonusCombined. I thought using COALESCE would do the trick like below but there are many cases where either CEOAnnualBonus or CEOBonus have a zero value instead of NULL and it doesn't work.

SELECT
COALESCE(CEOAnnualBonus, CEOBonus)
AS CEOBonusCombined
FROM tbenchmarktemp
WHERE Ticker='F'

Thanks for any help

View 3 Replies View Related

Why Have To Group All Fields When Using MIN / MAX

Dec 18, 2012

Lets say I have a list of customers, order date, and an item they ordered. I want to grab the MIN order date by customer, and the associated product. If I do:

Code:
SELECT customer,min(order date),item
FROM mytable
GROUP BY customer

I get an error because item is not aggregated. But I don't want to group on it and i don't want to select a min/max of it. i just want it to carry over the item that is associated with that min order date.

View 8 Replies View Related

Group By Or Distinct - But Several Fields

Feb 11, 2014

How can I use a Distinct or Group by statement on 1 field when calling All or at least several ones.

Example:
SELECT id_product, description_fr, DiffMAtrice, id_mark, id_type, NbDiffMatrice, nom_fr, nouveaute
From C_Product_Tempo

And I want Distinct or Group By nom_fr

View 19 Replies View Related

GROUP BY With Multiple Fields

Jun 12, 2014

I have two issues I'm trying to deal with in my code.

1. I'm trying to group by first and last name, which are in two different columns
2. I'm trying to take an average of pay per miles.

Neither of these is working well. Actually, neither is working at all.

This is the code!

SELECT
OD.DriverID,
(W.FirstName + W.LastName AS 'Driver'),
DATEADD(dd,(DATEDIFF(dd,0,O.ReadyTimeFrom)),0) AS Date,
DATENAME(dw,O.ReadyTimeFrom) AS DayOfTheWeek,
Count(OD.OrderID) AS 'Total Orders',
SUM(O.Distance) AS OrderMiles,

[Code] ....

View 2 Replies View Related

How Do I Get Group By Fields As Column Name?

Mar 10, 2008

Dear experts,

Hi, please do give me your expert advise and opinon on this matter:

I have a table name PerformaceRecords with a few columns, one of which is performance banding.
i.e.
PerformanceBanding
------------
Outstanding
Good
Average
Good
Poor

When I use a group by clause, i.e. Select PerformanceBanding, Count(PerformanceBanding) as ResultCount from PerformanceRecords group by PerformanceBanding

I got the result as

PerformanceBanding ResultCount
---------------------------------
Good 2
Poor 1
Average 1
Outstanding 1

What I want to get is the PerformanceBanding as columns and the Result as rows

i.e.

Good Poor Average Outstanding
----------------------------------
2 1 1 1

how do I go about modifying my SQL select statement to achieve this result?

Thank you in advance for assisting me.

View 9 Replies View Related

Non Aggregated Fields In Group By Clause

Jul 8, 2013

I'd like to have all distinct recordIDs with relevant text associated with them. Each record has 3 text boxes in different languages. Each text in different language is defined by an AttributeDefinitionID. This is my query:

Select a.entryID, g.GroupName, c.CategoryName as ExperienceType,
e.AttributeValue as EnglishWording,
e1.AttributeValue as GermanWording,
e2.AttributeValue as RussianWording,
From Entry as a
inner join entrycategory as b on b.entryid = a.entryid

[Code] ....

but in the results I get additional rows for each record even if the record doesnt have all three text boxes populated and there is only EnglishText for example.

EntryID GrouPName EnglishWording GermanWording RussianWording
1586 Red abc NULL NULL
1586 Red NULL NULL NULL
3566 Yellow NULL Hallo Welt NULL
3566 Yellow NULL NULL NULL
3566 Yellow Hello world NULL NULL
3566 Yellow Hello world Hallo Welt NULL

1586 should only return the first line with English wording.
3566 should return the last line that shows both English and German wording populated

View 19 Replies View Related

Many Fields Update From A Group By Clause

Jul 20, 2005

Hi All,In Oracle, I can easily make this query :UPDATE t1 SET (f1,f2)=(SELECT AVG(f3),SUM(f4)FROM t2WHERE t2.f5=t1.f6)WHERE f5='Something'I cannot seem to be able to do the same thing with MS-SQL. There areonly 2 ways I've figured out, and I fear performance cost in both cases,which are these :1)UPDATE t1 SET f1=(SELECT AVG(f3)FROM t2WHERE t2.f5=t1.f6)WHERE f5='Something'and then the same statement but with f2, and2)UPDATE t1 SET f1=(SELECT AVG(f3)FROM t2WHERE t2.f5=t1.f6),f2=(SELECT SUM(f4)FROM t2WHERE t2.f5=t1.f6)WHERE f5='Something'Is there a way with MS-SQL to do the Oracle equivalent in this case ?Thanks,Michel

View 3 Replies View Related

Using An Expression To Group On Multiple Fields

Mar 23, 2008



I have an exisitng report that lists unit name, provider, runday, shift, patient. The report groups by unit name and there is a page break after each unit name. So in the current environment the report prints one page per unit that contains all of the providers, rundays, shifts, and patients for that unit name its grouping on. So the report would like like this when it prints:

Unit A
Provider 1 Runday 1 Shift 1





patient 1
patient 2
Provider 1 Runday 1 Shift 2





patient 1
patient 2
Provider 1 Runday 2 Shift 1





patient 1
patient 2
Provider 1 Runday 2 Shift 2





patient 1
patient 2
Provider 2 Runday 1 Shift 1





patient 1
patient 2
Provider 2 Runday 1 Shift 2





patient 1
patient 2
Provider 2 Runday 2 Shift 1





patient 1
patient 2
Provider 2 Runday 2 Shift 2





patient 1
patient 2
PAGE BREAK
Unit B............(repeat data from page 1)
PAGE BREAK
Unit C............(repeat data from page 1

The end user would like the ability to keep the report as is but would like to also be able to print the report as one page per each unit name, provider, runday and shift. so it would look like this

Unit A
Provider 1 Runday 1 Shift 1





patient 1
patient 2
PAGE BREAK
Unit A
Provider 1 Runday 1 Shift 2





patient 1
patient 2
PAGE BREAK
Unit A
Provider 1 Runday 2 Shift 1





patient 1
patient 2




So I created a boolean parameter with a prompt of Page break by Unit, Provider, Runday & Shift? My thought is if the users sets this to False, the report will group on just Unit Name (the first example). If the user sets this to True, the report will group on Unit Name, Provider, Runday & Shift.

I set the grouping expression for this data table as:
=iif(Parameters!Grouping.Value = "False", Fields!unit_Name.Value,(Fields!unit_Name.Value,Fields!Lname.Value,Fields!Rundays.ValueFields!Shift.Value))


Within the expression editor window it displays a syntax error and the report will not run.

Any help would be greatly appreciated!!!!!!!!!

View 7 Replies View Related

Does The Group By Have To Include All Fields From The SELECT Clause?

Dec 3, 2007

hey all,

say i have the following function

SELECT GLF_CHART_ACCT.DESCR1, F1ADR_ADDRESS.ADDR1, F1ADR_ADDRESS.ADDR2,
F1ADR_ADDRESS.ADDR3, F1ADR_ADDRESS.ADDR_CITY, F1ADR_ADDRESS.ADDR_STATE,
F1ADR_ADDRESS.POST_CODE, F1ADR_ADDRESS.PHONE_NBR, F1ADR_ADDRESS.FAX_NBR,
F1ADR_ADDRESS.EMAIL_ADDR_NAME, F1ADR_ADDRESS.CONTACT_NAME,
F1ADR_ADDRESS.CONTACT_TITLE, GLF_CHART_ACCT.ACCNBRI, F1ADR_ADDRESS.ENTITY_UNIQUE_NBR

FROM GLF_CHART_ACCT

INNER JOIN F1ADR_ADDRESS ON (GLF_CHART_ACCT.CHART_NAME = F1ADR_ADDRESS.ENTITY_KEY1)
AND (GLF_CHART_ACCT.ACCNBRI = F1ADR_ADDRESS.ENTITY_KEY2)

GROUP BY GLF_CHART_ACCT.DESCR1, F1ADR_ADDRESS.ADDR1, F1ADR_ADDRESS.ADDR2,
F1ADR_ADDRESS.ADDR3, F1ADR_ADDRESS.ADDR_CITY, F1ADR_ADDRESS.ADDR_STATE,
F1ADR_ADDRESS.POST_CODE, F1ADR_ADDRESS.PHONE_NBR, F1ADR_ADDRESS.FAX_NBR,
F1ADR_ADDRESS.EMAIL_ADDR_NAME, F1ADR_ADDRESS.CONTACT_NAME, GLF_CHART_ACCT.ACCNBRI,
F1ADR_ADDRESS.CONTACT_TITLE, GLF_CHART_ACCT.CHART_NAME, F1ADR_ADDRESS.ENTITY_UNIQUE_NBR,
GLF_CHART_ACCT.SELN_TYPE1_CODE

HAVING CHART_NAME='ARCHART' AND GLF_CHART_ACCT.DESCR1 <> '' AND GLF_CHART_ACCT.SELN_TYPE1_CODE = 'Trade'
AND GLF_CHART_ACCT.DESCR1 LIKE '%" + Search + "%' ORDER BY GLF_CHART_ACCT.DESCR1;

I get errors if not all the fields are included in the group by clause.

what i dont get is why i have to create seperate groups for this query...or am i reading it wrong??

Cheers,

Justin

View 5 Replies View Related

Update Certain Fields In User Group Table With New Info

Apr 28, 2014

I've just written a query that successfully brings back the data from one table based on the information from another. Basically we have been given a table of information and need to update certain fields in our user_group table with the new info.

Here is the SELECT statement
SELECT user_group.id, user_group.name, user_group.description, Consultants.description AS Expr10, user_group.btype, user_group.rootmenu,
user_group.intra_user, user_group.primary_g_id, user_group.fname, user_group.lname, user_group.ntlogon, user_group.lang_id,
user_group.[external], user_group.title, user_group.work_tel, user_group.work_fax, user_group.work_ext, user_group.mobile, user_group.sex,
user_group.add2, user_group.add3, user_group.town, user_group.county, user_group.pcode, user_group.private_flag,

[code]....

We want to update the 'description' on the user_group table with the 'description' from the 'consultants' table. To test this, we only want to write the UPDATE so that it changes the description where the name is 'Adam Froth. The UPDATE statement that we've written is

UPDATE user_group
SET user_group.description = Consultants.description
FROM user_group
INNER JOIN Consultants
ON user_group.description = consultants.description
WHERE name like 'Adam Froth%'

but it keeps erroring and saying that it could 'Not be bound'.

View 2 Replies View Related

T-SQL (SS2K8) :: Sequential Data Selection - Identify Different Fields Within A Group Of Records?

Jun 18, 2014

How to identify different fields with in a group of records?

Example:
create table #test
(ID int, Text varchar(10))
insert into #test
select 1, 'ab'
union all
select 1, 'ab'

[Code] ...

I want to show additional field as Matched as ID 1 has same Text field on both the records, and for the ID 2 I want to show Unmatched as the Text fields are different but with the same ID.

View 1 Replies View Related

Reporting Services :: Display Group Name Value Of Each Group In Column Header Outside The Group?

Sep 29, 2015

I have an SSRS 2012 table report with groups; each group is broken ie. one group for one page, and there are multiple groups in multiple pages.

'GroupName' column has multiple values - X,Y,Z,......

I need to group 'GroupName' with X,Y,Z,..... ie value X in page 1,value Y in page 2, value Z in page 3...

Now, I need to display another column (ABC) in this table report (outside the group column 'GroupName'); this outside column itself is another column header (not a group header) in the table (report) and it derives its name partly from the 'GroupName'  values:

Example:

Value X for GroupName in page 1 will mean, in page 1, column Name of ABC column must be ABC-X Value Y for GroupName in page 2 will mean, in page 2, column Name of ABC column must be ABC-Y Value Z for GroupName in page 3 will mean, in page 3, column Name of
ABC column must be ABC-Z

ie the column name of ABC (Clm ABC)  must be dynamic as per the GroupName values (X,Y,Z....)

Page1:

GroupName                 Clm ABC-X

X

Page2:

GroupName                 Clm ABC-Y

Y

Page3:

GroupName                 Clm ABC-Z

Z

I have been able to use First(ReportItems!GroupName.Value) in the Page Header to get GroupNames displayed in each page; I get X in page 1, Y in page 2, Z in page 3.....

However, when I use ReportItems (that refers to a group name) in the Report Body outside the group,

I get the following error:

Report item expressions can only refer to other report items within the same grouping scope or a containing grouping scope

I need to get the X, Y, Z ... in each page for the column ABC.

I have been able to use this - First(Fields!GroupName.Value); however, I get ABC-X, ABC-X, ABC-X in each of the pages for the ABC column, instead of ABC-X in page 1, ABC-Y in page 2, ABC-Z in page 3, ...

View 4 Replies View Related

A SqlDataReader Is Returning An Int, When It Should Be Returning A Tinyint

Sep 25, 2007

I am opening a simple command against a view which joins 2 tables, so that I can return a column which is defined as a tinyint in one of the tables.  The SELECT looks like this:
 SELECT TreatmentStatus FROM vwReferralWithAdmissionDischarge WHERE ClientNumber = 138238 AND CaseNumber = 1 AND ProviderNumber = 89
 The TreatmentStatus column is a tinyint.  When I execute that above SQL SELECT statement in SQL Server Management Studio (I am using SQL Server 2005) I get a value of 2.  But when I execute the same SQL SELECT statement as a part of a SqlDataReader and SqlCommand, I get a return data type of integer and a value of 1.
Why?

View 5 Replies View Related

Replication With Additional RAM

Oct 21, 2002

Currently both of our servers have 1 gig of RAM. We are adding and additional 1gig of RAM to our local server but none to the remote server. Transactional replication is performed between both servers in both directions. SQL Server is configured to dynamically configure memory on both servers.

Are there any issues or concerns that I should be aware of?
Thanks

View 1 Replies View Related

SQL Code To Use For Additional Search

Jul 6, 2005

I have code on a website that does a search to an Access database based on what the person enters as the search criteria.  My SQL code uses a like % statement for all the fields in the search criteria.  The problem is that the first and third search fields do no return the search criteria that is asked for.....The 2nd search field (Description) returns whatever is asked for.....   I did read up and found that the data must be character for the like statement.  Anyone have any other clues or where I can read up on this???????HTML SEARCH CODE:          <table ALIGN="CENTER" width="408" bgcolor="#FFFFFF" cellspacing="0" cellpadding="5">        <tr>    <td width="400" bgcolor="#3366cc" colspan="2">    <form method="post" name="DaForm" action="Makeit.asp" align="center">      <div align="center"><center><table border="1" width="350" cellpadding="3"      bgcolor="#3366cc">        <tr>          <td align="left" width="189"><select name="TypeSearch" size="1">            <option selected value="PartNumber">Part Number</option>            <option value="Description">Description </option>            <option value="Mfg">Manufacturer</option>          </select></td>          <td width="310" align="right"><input type="text" size="30" name="DaInBox"></td>        </tr>        <tr>          <td colspan="3" align="center" width="507"><div align="left"><p><input type="submit"          name="B1" value="Search!"><input type="reset" name="B2" value="Clear">          </td>        </tr>      </table>      </center></div>    </form>    </td>  </tr></table>Makeit ASP COde:
<%@ LANGUAGE="VBSCRIPT" %>
<html>
<head>
<title>Your Search Results!</title>
<meta name="Microsoft Border" content="lb, default">
</head>
<body>
<%
Dim MySql
 
Set cn = Server.CreateObject("ADODB.Connection")
cn.Open("parts")
MySql = "SELECT * FROM parts"
If Request.Form("TypeSearch") = "Part Number" Then
MySql = MySql & " WHERE PartNumber LIKE '%" &_
Request.Form("DaInBox") & "%'"
End If
If Request.Form("TypeSearch") = "Description" Then
MySql = MySql & " WHERE Description LIKE '%" & _
Request.Form("DaInBox") & "%'"
End If
Dim rs
Set rs = new Server.CreateObject("ADODB.Recordset")
rs.Open MySql, cn, 0,1
%>
<% If rs.BOF and rs.EOF Then%>
<h2 align="center">We did not find a match!</h2>
<%Else%>
 
<%If Not rs.BOF Then%>
<h2>Here are the results of your search:</h2>
<table BORDER="0" width="100%" cellpadding="3">
<tr>
<th bgcolor="#0366cc"><font face="Arial" color="#000000">Part Number </font></th>
<th bgcolor="#3366cc"><font face="Arial" color="#000000">Description </font></th>
<th bgcolor="#3366cc"><font face="Arial" color="#000000">Manufacturer </font></th>
<th bgcolor="#3366cc"><font face="Arial" color="#000000">Qty </font></th>
<th bgcolor="#3366cc"><font face="Arial" color="#000000">Condition </font></th>
</tr>
<%
Do While Not rs.EOF
%>
<tr>
<td><%=rs("PartNumber")%>
<%=rs("Description")%>

</td>
</tr>
<% rs.MoveNext
Loop
%>
</table>
<%End If%>
<%End If%>
<%
rs.Close
cn.Close
Set rs = Nothing
Set cn = Nothing
%>
<p>&nbsp;</p>
</body>

View 1 Replies View Related

Adding An Additional Database

Feb 28, 2001

Hi,

What are all the performance parameters to be analyzed, in an existing production server, to accommodate an additional database.

Regards
Kalyan

View 1 Replies View Related

Additional Rows In Result

Feb 12, 2014

I have two tables that I am pulling data from to insert into a third table.

Table 1:
Organization Address Date
Name 404 St. 12/31/1999

Table 2:
Organization Software Type Quantity
Name SW1 5
Name SW2 6
Name SW3 7
Name SW4 8

My query looks something like this:

INSERT INTO Organization SW Reqs (Name, Address, Date, SW1 Quantity, SW2 Quantity, SW3 Quantity)
SELECT Table 1.Name, Table 1.Address, Table 1.Date,
(Select Table 2.Quantity Where Table 2.Software Type = 'SW1'),
(Select Table 2.Quantity Where Table 2.Software Type = 'SW2'),
(Select Table 2.Quantity Where Table 2.Software Type = 'SW3')
FROM Table 1, Table 2
WHERE Table 1.Organization = Table 2. Organization

Sadly, this query gives me four rows, one for each Software Type. I have tried putting DISTINCT after my SELECT, but that narrows it down to two rows only. I would really like to have just a one row result per organization.

View 2 Replies View Related

How Do I Insert Additional Table Between 2 Others?

Mar 10, 2006

Part of the code as follows:

SELECT
ARDoc."Cpnyid", ARDoc."Custid", ARDoc."CuryOrigDocAmt", ARDoc."DocBal", ARDoc."DocDate", ARDoc."Doctype", ARDoc."slsperid", ARDoc."Territory", ARDoc."RecordType", ARDoc."user7",
ARTran."CmmnPct", ARTran."CuryTranAmt", ARTran."DrCr", ARTran."ExtCost", ARTran."InvtId", ARTran."JrnlType", ARTran."Qty", ARTran."RefNbr", ARTran."Rlsed", ARTran."S4Future04", ARTran."S4Future05", ARTran."TranAmt", ARTran."TranClass", ARTran."TranDate", ARTran."TranType", ARTran."UnitDesc", ARTran."UnitPrice",
RptCompany."CpnyName", RptCompany."RI_ID",
Customer."Name",
Salesperson."CmmnPct", Salesperson."Name", Salesperson."SlsperId"
FROM
{ oj ((("SOLUSBS02APP"."dbo"."zARDoc_Comm" ARDoc INNER JOIN "SOLUSBS02APP"."dbo"."RptCompany" RptCompany ON
ARDoc."Cpnyid" = RptCompany."CpnyID")
INNER JOIN "SOLUSBS02APP"."dbo"."Customer" Customer ON
ARDoc."Custid" = Customer."CustId")
LEFT OUTER JOIN "SOLUSBS02APP"."dbo"."Salesperson" Salesperson ON
ARDoc."slsperid" = Salesperson."SlsperId")
LEFT OUTER JOIN "SOLUSBS02APP"."dbo"."ARTran" ARTran ON
ARDoc."Custid" = ARTran."CustId" AND
ARDoc."Refnbr" = ARTran."RefNbr" AND
ARDoc."Doctype" = ARTran."TranType"}

Currently, if a new rep takes over for an old ones invoices and accounts...he will also get credit on the report which this query is for. Instead I need to use a table SOShipHeader to be 'date sensitive'. SOShipHeader will have the correct 'SlsperID', but will still need to pull the name from Salesperson."Name"

My guess, would be that I need to wedge the SOShipHeader table between the ARDoc and Salesperson tables?

View 5 Replies View Related

How To Generate An Additional Field

Apr 11, 2006

I have the following fields in table A:

GL_ID|GL_Name_VC| Amount |Period_TI|Year_SI|
===================================================
1000| Sales_HW| -20,000.00 | 01 | 2005
===================================================
1000| Sales_SW| -10,000.00 | 01 | 2005
===================================================
1001| Cost_HW | 5,000.00 | 01 | 2005
===================================================
1001| Cost_SW | 5,000.00 | 01 | 2005

the fields above have the following datatype:

Fields | Datatype
===================================
GL_ID | Integer
GL_Name_VC | Variable Character
Amount | Integer
Period_TI | TinyInteger
Year_SI | SmallInteger

The above database is running on Microsoft SQL Server 2000 and i would like to query
for a report that looks something as below:

Sales Category | Sales | Cost | Profit
=================================================
HW |-20,000.00 |5,000.00| -15,000.00
SW |-10,000.00 |5,000.00| -5,000.00
=================================================
Total |-30,000.00 |10,000.00|-20,000.00


The above report have 4 columns, with last column being a calculated field (Sales-Cost)

Guys, hope someone out there can help me with the sql command for the above report?

View 2 Replies View Related

Creating Additional Instances

Feb 20, 2007

How do I create additional instances of any MSSQL 2005 service(specifically database and analysis) given that a default instance is present?

View 4 Replies View Related

SQL ExpresS OR Additional Licenses??????

Jul 31, 2006

We are
looking for a solution for a client that we will make software for. We are a ISV. After
completion of the software, our client then wants to sell this software to their
partners, people in that business, etc. We do not want to add any additional cost, by means of them(client(s)) purchasing
a server, server software or licensing. Is there any solution
that will make this work? A runtime or embedded database solution? If there is a
license we need to purchase, what would that be? SQL Express Edition work?

View 4 Replies View Related

Additional 0 To Column Data

Jul 6, 2006

Hi

I have a column in the db with serial number data, on a export that I am doing the data has to be 10 digits long the problem is not all of them are eg

12234

122334343

1234234567

how can i get it to look like this adding an 0 to the front to make the row 10 digits

0000012234

0122334343

1234234567

Thanks

View 6 Replies View Related

Adding Additional Column

Feb 29, 2008

Hi All,

I have developed a report using report viewer in asp.net web form. The report is generated based on the selection of Department. User have an option to multi select the departments so the department column grows. Lets say user select Business category first and generate the report then user decides to add another department say Engineering. No the report column headers will have addional column "Engineering". I have used the Matrix since I had to group by Name and dates. Everything is good so far.
Now I have to add an additional column "Notes" at the end of all the columns. If there is ony department is chosen then Notes column appears after that and if mulitple departments are chosen the Notes column should also appear after all the department column (at the very end).
I am really having hard time to accomplish this. Is there any suggestion or solution to finish this? I really appreciate your responses.

Thank you.

View 1 Replies View Related

Stored Procedure Returning 2 Result Sets - How Do I Stop The Procedure From Returning The First?

Jan 10, 2007

I hvae a stored procedure that has this at the end of it:
BEGIN
      EXEC @ActionID = ActionInsert '', @PackageID, @AnotherID, 0, ''
END
SET NOCOUNT OFF
 
SELECT Something
FROM Something
Joins…..
Where Something = Something
now, ActionInsert returns a Value, and has a SELECT @ActionID at the end of the stored procedure.
What's happening, if that 2nd line that I pasted gets called, 2 result sets are being returned. How can I modify this SToredProcedure to stop returning the result set from ActionINsert?

View 2 Replies View Related

FOR XML AUTO Returns Too Many Additional Elements

Jul 23, 2007

Hi, I use the FOR XML AUTO to retrive native XML from a database with:
SELECT [xml] FROM myxml WHERE id = 81 FOR XML AUTO, elements, root('ROOT')"
However it returns the database name and table name as parent elements. How can I return just my raw XML data without additional elements:
XML is Stored:
<ROOT>
 <CHAPTER>
  <TITLE>This is a test</TITLE> </CHAPTER>
</ROOT>
Returns:
<databasename>
<tablename>
<ROOT>
  <CHAPTER>
    <TITLE>This is a test</TITLE>  </CHAPTER>
</ROOT>
</tablename>
</databasename>

View 1 Replies View Related

Additional Criteria In LEFT JOIN

Jan 18, 2008

I have a stored procedure which is used to search records in the database based on the data sent from the web page. There are several search fields and all of them are in one table (Table1) except the "CallerName" field which is in a different table (Table2). Since I had to show CallerName also in the gridview apart from other columns, I did a LEFT JOIN (using field CallerNumber) to show all the required fields from Table1 and CallerName from Table2.
Now heres the problem. Since CallerName is a search criteria, its supposed to be in the WHERE clause after the JOIN or in the JOIN clause itself. The problem is, if I put it in WHERE clause, the result set doesn't show records from Table1 which do not have a matching CallerNumber in Table2. SELECT T1.CallerNumber, T1.DateCalled, T2.CallerName
FROM Table1 T1
LEFT JOIN Table2 T2 on
T1.CallerNumber = T2.CallerNumber
WHERE T1.CallerNumber = 'some number' AND T2.CallerName = 'some name' If I put it in the JOIN condition, it works just like a LEFT JOIN is supposed to work, showing all the records in Table1 and also those which had CallerName in Table2. SELECT T1.CallerNumber, T1.DateCalled, T2.CallerName
FROM Table1 T1
LEFT JOIN Table2 T2 on
T1.CallerNumber = T2.CallerNumber AND T2.CallerName = 'some name'
WHERE T1.CallerNumber = 'some number'

1st SQL won't work for me because it doesn't show all the records in Table1, even when no search criteria is specified.2nd SQL won't work for me because it shows more than required when just CallerName is sent from the web page as search criteria. It will show all the records where CallerName is "some name" and also all the additional records (since it is a left join).
Can I get the goodness of both in one or do I have to create two separate Stored Procedures?
Thanks all,Bullpit
 

View 11 Replies View Related

Additional Column To Table Not Getting Written To..

Feb 27, 2008

I added one crummy column to my table.  I updated the stored procedure and added the thing to the aspx page which is my form for adding an article. I have a strong feeling that something is foul over here...Why is it that Visual Studio will not allow me to capitalize the word get and when I delete the ()  after ShortDesc they immediatlye reappear and the get statement is set to get. Every other one of them, and there are 9 others use GET and there is no () after the public property variable name. Does anyone know the reason for this?  
Public Property Author As System.String
GETReturn _Author
End Get Set(ByVal Value As System.String)
_Author= ValueEnd Set
End PropertyPublic Property ShortDesc() As System.String
GetReturn _ShortDesc
End GetSet(ByVal value As System.String)
End Set
End Property

View 1 Replies View Related

Why Additional Information: System Error.?

Dec 18, 2003

I have a DataGrid, it will return a table in SQL2000 server.

the problem is:

no data in the datagird, only a record "null" in all field.

I find a sample is add a "sqlDataAdapter1.Fill".

but if I add the code:

sqlDataAdapter1.Fill(dataSet21);

I got the error:

---------------

An unhandled exception of type 'System.Data.SqlClient.SqlException' occurred in system.data.dll

Additional information: System error.

-------------

I have search this problem fix many many time, many people has this problem, looks like no result I can find.

Please help, thanks very very much.

Thanks.

View 2 Replies View Related







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