Positioning An Added Column...

Jan 28, 2004

how do I position a newly added column in the table?
the default is at the very end.

what would I have to add to this code:

ALTER TABLE Vehicles
ADD Model varchar(55)

Thanks

View 2 Replies


ADVERTISEMENT

I Added A Column To A Table, But, I Can't See It.

May 15, 2007

I ran the code below that adds a column to an SQL table.

I refreshed Data Sources, but, the new column does not appear.

I refreshed Server Explorer and the new column does not appear.

I tried running the code again and I got:

"Column names in each table must be unique. Column name 'CaseNbr' in table 'Patient' is specified more than once."

so the column did actually get added, but, I can't see it.



Imports System.Data.SqlClient

Public Class Form1

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

'Try

Dim sqlConnection As New System.Data.SqlClient.SqlConnection("Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Patient.mdf;Integrated Security=True;User Instance=True")

Dim str As String = "ALTER TABLE Patient ADD CaseNbr Varchar(50)"

Dim command As New System.Data.SqlClient.SqlCommand(str, sqlConnection)

sqlConnection.Open()

command.ExecuteNonQuery()

sqlConnection.Close()

'Catch

'End Try

Close()

End Sub

End Class

View 5 Replies View Related

Added Column To Article But DTS Isn't Recognizing It

Dec 9, 2002

We're replicating columns in a table from 7.0 server to SQL2k server. Once we've got the data on SQL2k, we were able to take advantage of DTS that was not available in version 7.0.

I recenlty added a column to the article and changed the DTS accordingly (transformation columns). However, I'm getting this error ever though I added the new column in the DTS.

-------
The number of columns in the bcp file does not match what is defined in the DTS package. Regenerate the package.

-----

I've recreated the package with no luck. This is becoming urgent as it's supposed to go into production soon.

Please help!!

Thanks,

Colleen

View 2 Replies View Related

Is It Possible To Find Out When A Particular Column Was Added To A Table?

Nov 4, 2005

Is it possible to find out when a particular column was added to any table?

Thanks

View 1 Replies View Related

How To Set Column Where Rows Will Be Added Alphabetically

Jun 12, 2015

I am using 2014 SQL Express. How I can get the rows By first column named agentname) in a table to be listed alphabetically?

View 6 Replies View Related

New Column Added In Subscriber Database Tables

Jun 24, 2008

Dear All,
i dont know the exact reson why, but i'm guessing the reason for each table had a new guid column is because of transactional replication with update subscribers. actually i dont need this.
can i change this to transactional replication? or i need to drop the column in each table? please guide me

Arnav
Even you learn 1%, Learn it with 100% confidence.

View 6 Replies View Related

Added A Column To My SQL Database And Now Text Field Will Not Write To It. Why???

Aug 28, 2006

I have a web form that is an interface for a database.  The code was working fine until a field needed to be added.  So I added the new field, updated the data adapter and data set, and when i enter the data into the field, all of the old fields are getting updated, but the new ones aren't.  I am at wits end as to why.  Can someone please help!!! I am using VS Studio 2000 ASP.NET and C#.  The code is below.  The bold items are the new fields.using System;using System.Collections;using System.ComponentModel;using System.Data;using System.Drawing;using System.Web;using System.Web.SessionState;using System.Web.UI;using System.Web.UI.WebControls;using System.Web.UI.HtmlControls;namespace TrafficDept{/// <summary>/// Summary description for AddOwner./// </summary>public class AddOwner : System.Web.UI.Page{protected System.Web.UI.WebControls.Button Button1;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator3;protected System.Data.SqlClient.SqlConnection sqlConnection1;protected System.Web.UI.WebControls.TextBox TextBox1;protected System.Web.UI.WebControls.TextBox TextBox2;protected System.Data.SqlClient.SqlDataAdapter daAddOwner;protected System.Web.UI.WebControls.TextBox tbOtherOwnerLName;protected System.Web.UI.WebControls.Panel namePanel;protected System.Web.UI.WebControls.TextBox tbOtherOwnerMI;protected System.Web.UI.WebControls.TextBox tbOtherOwnerFName;protected System.Web.UI.WebControls.TextBox tbSecondOwnerLName;protected System.Web.UI.WebControls.TextBox tbSecondOwnerMI;protected System.Web.UI.WebControls.TextBox tbSecondOwnerFName;protected System.Web.UI.WebControls.Button Button4;protected SiteCubed.EditWorksProfessional tbNote;protected System.Web.UI.WebControls.Panel notePanel;protected System.Web.UI.WebControls.DropDownList ddlStatus;protected PeterBlum.PetersDatePackage.DateTextBox tbRegDate;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator2;protected System.Web.UI.WebControls.TextBox tbOwner;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator1;protected System.Web.UI.WebControls.TextBox tbOwnerMI;protected System.Web.UI.WebControls.TextBox tbOwnerLName;protected System.Web.UI.WebControls.RequiredFieldValidator RequiredFieldValidator4;protected System.Web.UI.WebControls.TextBox tbBusinessName;protected System.Web.UI.WebControls.TextBox tbAddress;protected System.Web.UI.WebControls.TextBox tbRegNo;protected System.Web.UI.WebControls.TextBox tbPreviousOwner;protected System.Web.UI.WebControls.TextBox tbPOwnerAddress;protected System.Web.UI.WebControls.TextBox tbPORegNo;protected PeterBlum.PetersDatePackage.DateTextBox tbTransferDate;protected System.Web.UI.WebControls.DropDownList ddlMeans;protected System.Web.UI.WebControls.Button Button3;protected System.Web.UI.WebControls.Button Button2;protected System.Data.SqlClient.SqlCommand sqlSelectCommand1;protected System.Data.SqlClient.SqlCommand sqlInsertCommand1;protected System.Data.SqlClient.SqlCommand sqlUpdateCommand1;protected System.Data.SqlClient.SqlCommand sqlDeleteCommand1;protected TrafficDept.dsAddOwner dsAddOwner1;  private void Page_Load(object sender, System.EventArgs e){// Put user code to initialize the page here}#region Web Form Designer generated codeprivate void Button2_Click(object sender, System.EventArgs e){Response.Redirect("AddOthers.aspx");}private void Button1_Click(object sender, System.EventArgs e){daAddOwner.Fill(dsAddOwner1);dsAddOwner.OwnershipRow drOwner = dsAddOwner1.Ownership.NewOwnershipRow();drOwner.Plates_ID = int.Parse(Session["PlatesID"].ToString());drOwner.Status = ddlStatus.SelectedItem.Text;drOwner.Current_Legal_Owner = tbOwner.Text;drOwner.Owner_CurrentLegalOwnerMI = tbOwnerMI.Text.ToString();drOwner.Owner_CurrentLegalOwnerLName = tbOwnerLName.Text;drOwner.Owner_CurrentBusinessName = tbBusinessName.Text;if (!tbRegDate.xIsEmpty)drOwner.Date_of_Registration = DateTime.Parse(tbRegDate.Text.ToString());drOwner.Address_of_Current_Owner = tbAddress.Text;drOwner.Reg_No_for_Current_Owner = tbRegNo.Text;drOwner.Previous_Owner = tbPreviousOwner.Text;drOwner.Previous_Owner_Address = tbPOwnerAddress.Text;drOwner.Reg_No_for_Previous_Owner = tbPORegNo.Text;if (!tbTransferDate.xIsEmpty)drOwner.Date_of_Transfer = DateTime.Parse(tbTransferDate.Text.ToString());drOwner.By_Means_of = ddlMeans.SelectedItem.Text;drOwner.Owner_SecondaryLegalOwnerFName = tbSecondOwnerFName.Text;drOwner.Owner_SecondaryLegalOwnerMI = tbSecondOwnerMI.Text;drOwner.Owner_SecondaryLegalOwnerLName = tbSecondOwnerLName.Text;drOwner.Owner_OtherLegalOwnerFName = tbOtherOwnerFName.Text;drOwner.Owner_OtherLegalOwnerMI = tbOtherOwnerMI.Text;drOwner.Owner_OtherLegalOwnerLName = tbOtherOwnerLName.Text;drOwner.Owner_Notes = tbNote.Text;dsAddOwner1.Ownership.Rows.Add(drOwner);daAddOwner.Update(dsAddOwner1);Response.Redirect("AddOthersTP.aspx");}private void Button3_Click(object sender, System.EventArgs e){//daAddOwner.Fill(dsAddOwner1);//dsAddOwner.OwnershipRow drAddOwner = dsAddOwner1.Ownership.NewOwnershipRow();namePanel.Visible = true; }private void Button4_Click(object sender, System.EventArgs e){notePanel.Visible = true;}}}

View 1 Replies View Related

SQL 2012 :: Change Properties Of A Table Which Have Filestream When Column Added To It

Dec 6, 2014

I store files in db in sql server 2008 by filestream. But when a column would be added to table which have filestream, properties of table would be changed. by every things change on table, retrieve files will faced to error. but store process work probably.

and filestream filegroup at following address will be empty. why?

Right click on table --> properties --> storage --> filestream filegroup

View 0 Replies View Related

JPGs Added To Image Column Truncated At 1024 Bytes

Mar 26, 2007

I have a table in a SQL 2005 database that is designed to hold JPG product images for a website. Here is the schema:

create table dbo.Eur_RMISWebInterface_Staging_ProductImages(
product_code varchar(12) not null,
image_order smallint not null,
colour_identifier varchar(10) not null,
image_data image not null,
constraint PK_Eur_RMISWebInterface_Staging_ProductImages primary key clustered (
product_code,
image_order
)
)

Product images are inserted into the table from a database on a remote SQL 2000 server. Here is the script that does that (uses dynamic SQL):

set @SQLCmd = '
set xact_abort on

begin transaction

delete Eur_RMISWebInterface_Staging_ProductImages

insert Eur_RMISWebInterface_Staging_ProductImages (
product_code,
image_order,
colour_identifier,
image_data
)
exec "' + @RMISServerName + '".' + @RMISDatabaseName + '.dbo.Eur_RMISWebInterface_GetProductImagesForWeb ' + convert(varchar(3), @PortalID) + ', ' + @Locale_LCID + '

commit transaction'
execute (@SQLCmd)

About 500 images, each about 20KB, are transferred at a time. Here is the problem - when this script is run manually, all the images are inserted completely. When the script is run as part of a job (that has several other steps), the job step completes successfully and all the images are inserted, but every single one is truncated to the first 1024 bytes of the image. What this ends up looking like on the website is a a narrow strip of image instead of a complete image. Here are some other observations:

- When I changed the "Eur_RMISWebInterface_GetProductImagesForWeb" SP to only return 1 product image instead of 500 it still failed
- The owner of the job is the same Windows user as the user I have been running the script manually as
- I have tried changing the datatype of image_data from image to varbinary(max) but it made no difference

What could possibly be going on???

View 3 Replies View Related

Horizontal Positioning

Jul 20, 2005

Hello all,Thinking about building a new database in the enterprise addition ofsql server and using some horizontal parititioning techniques in orderto accomaodat what will eventually be a monster huge database.Can you share some hard earned experience, gotchas, etc...with me? Wewill be setting up this server on a SAN array that will be made up ofjust one or two huge virtual RAID10 volumes and I am also wonderingabout the wisdom of this? Its simple and should work, but is thatconfig relevant in any way specifically to our plan to partition?

View 2 Replies View Related

Tables And Positioning

Jun 11, 2007

Hello,



I am trying to create a report which needs to print the table footer (not page footer) at the bottom of the page, regardless of the amount of data (detail). How do I go about this?



Thanks,

Tyler

View 1 Replies View Related

Pie Char Positioning

May 2, 2008

Hi,
In a report we have a couple of pie charts one for each category.
for eg. if there are 3 categories red,blue and yellow there will be three pie charts. Now the data is shown to a particular user only if the user has access to a particular category.
suppose while designing the report the pie charts are created in the order : chart - red chart - blue chart - yellow.

If a user has rights only on the yellow category, only one chart will be displayed and chart-red and chart-blue will be hidden. Now the problem is, on the report I get blank space before chart-yellow as chart-red and chart- blue are hidden. is there a way to position chart - yellow in place of chart-blue if chart-blue is hidden or position chart-yellow in place of chart -red if chart-red and chart- blue both are hidded?

Thanks in advance,

Regards,
Harshal.

View 6 Replies View Related

Positioning Problem

May 4, 2008

I have a report which contains just one textbox. I set the location of this textbox to 0cm x 0cm. Page size is 8,27in x 11,69in (A4). I want this textbox to be printed 15cm from the top and 15cm from the left. What should I do to achieve this? I tried using report maegins, but no success.

View 1 Replies View Related

Positioning Of Stored Procedures

Aug 15, 2007

Hi all,I have been facing this dilemma since when I started coding in asp.net 2.0. I can have Data Access Layer wherein I can write stored procedures to access the data from database. I can create data access object, data table and all other stuff. Also I can create stored procedure in SQL 2000 server, and then access them from the Data Access layer. Which of the two method is preferable, and why. i have been searching net for answers to this question since long, but could not find anything. All answers can contribute may be little but invaluable knowledge.Thanks. 

View 10 Replies View Related

Positioning Tables And Graphs On A Page Using Rectangles (or Anything!)

May 15, 2007

I am creating a report that contains several tables and graphs. The report should fit on one page. It is a dashboard type of report that gives a quick look at key information. I have several sections that have related objects - a table and a graph for the same subject. I grouped the subjects into rectangles so that I could have a nice border around each section. However, when the report is rendered in IE, the rectangles do not stay together, and I have white space between them. I tried putting a background color on the body, but the background color does not show when the report is rendered in IE.



I tried a work-around using lines, not rectangles, to separate sections. The spacing seems to be working, but again the background color is not showing on the rendered report, so that is not a viable option.



As a work-around for my work-around, I put the objects within one rectangle, again using lines to separate sections. However, the spacing of the objects within the rectangle is not working - I am left with large blank spaces again.



Has anyone run into the same problems?




TIA,

eBeth

View 4 Replies View Related

Contract And Queue Confusion If Named The Same Plus Positioning Issue.............

Nov 17, 2006

Hello,

The problem I was having regarding re-enable a queue was because it was in another database. I am guessing it did that because the contract and Queues have the same name. I double checked and nothing pointed to that database. I fixed it because I can re-enable the queue in the other database and it is fixed. My question is why did this happen? The other issue I am still having is regarding why the queue got disabled to begin with. I understand that it was because of positioning but do not understand how or why and how to provent it from being disabled.

Thanks,

Scott Allison...

View 1 Replies View Related

Reporting Services :: Dynamic Positioning Of Text Boxes In SSRS

Sep 30, 2015

I have a user table with Label and value fields where i would like to control the display of the text boxes based on the values selected in my user table.Can we adjust the text box positions dynamically based on the user table values.

Ex: Table

Label1 Field1 Label2  Field2  Label3 Field3
ID       100                           Dept   Sales

Report Design :

Label1: ID    Field1:100
Label2:          Field2:
Label3:Dept   Field3:Sales

Expected Result :

Label1: ID    Field1:100
Label3:Dept   Field3:Sales

In my table i don't have values for Label 2 & Field 2 , can we adjust the spacing conditionally to be utilized by Label3 & Field3 in SSRS.

Note : Above mentioned data is just for an example and in my actual report i can have more than 3 columns and report is looking ugly with all the spacing if i don't have data in all the fields.

View 9 Replies View Related

Flat File Connection Manager Throws Error When A Column Gets Added To The Flat File

Dec 27, 2006

Hi,

I have a situation where a tab limited text file is used to populate a sql server table.

The tab limited text file comes from a third party vendor. There are fixed number of columns we need to export to the sql server table. However the third party may add colums in the text file. Whenenver the text file has an added column (which we dont need to import) the build fails since the flat file connection manager does not create the metadata for it again. The problem goes away  where I press the button "Reset Columns" since it builds the metadata then. Since we need to build the tables everyday we cannot automate it using SSIS because the metadata does not change automatically. Is there a way out in SSIS?

View 5 Replies View Related

Question (X-axis): How Does Automatic X-axis Label Positioning Work?

Jul 19, 2007

All,

I have read through the following:

http://technet.microsoft.com/en-us/library/aa964128.aspx.

The relevant section of this document is :-

Question (X-axis): How does automatic x-axis label positioning work?
Answer: Currently, built-in Reporting Services charts only allow automatic positioning in order to avoid overlapping the x-axis labels. The label direction (horizontal/vertical) of the axis labels depends on the label string sizes and the available space. X-axis labels are either shown horizontally in one line, horizontally in multiple lines with line breaks, or vertically. Showing x-axis labels at an angle, or explicit manual control over individual x-axis label positions is currently not supported.

Note There are several third-party chart add-ins that enable more control over axis labels. These add-ins can be installed on top of Reporting Services 2005.

I have exactly the problem indicated above in that some sectors of my Pie Charts I am are trying to produce are small and are close together thus labels overlap in some cases. As it says above, only automatic placing of the labels is available, but there could be a solution through third party software.

Does anyone know of a 3rd party solution/add in or a workaround?

Thanks
Msuk

View 3 Replies View Related

No Record Added On My DB

Nov 22, 2006

Hi! could you please check my code on adding record on my DB.. Im using SQL Server included on VWD.Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click        Dim con As String = "Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Request.mdf;Integrated Security=True;User            Instance=True"        Dim sqlcon As New Data.SqlClient.SqlConnection(con)        Dim sqlcmd As New Data.SqlClient.SqlCommand("Insert into uRequest (eticket, ename, edept, edetails, ejobpend, edate) values (@eticket,@ename,@edept,@edetails,@jobpend,@edate)")        sqlcon.Open()        sqlcmd.Parameters.Add("@eticket", Data.SqlDbType.Char, 10).Value = "11-0010-06"        sqlcmd.Parameters.Add("@ename", Data.SqlDbType.Char, 100).Value = User.Identity.Name        sqlcmd.Parameters.Add("@edept", Data.SqlDbType.Char, 50).Value = DropDownList1.Text        sqlcmd.Parameters.Add("@edate", Data.SqlDbType.DateTime).Value = Date.Now        sqlcmd.Parameters.Add("@edetails", Data.SqlDbType.Text).Value = TextBox1.Text        sqlcmd.Parameters.Add("@ejobpend", Data.SqlDbType.Text).Value = TextBox2.Text        sqlcon.Close()    End Sub  I've check the Data on my DB but nothing has been added. nwy, how can u create a confirmation message if the record has been successfully added.Thanks and sorry for the trouble. 

View 1 Replies View Related

How To Get The Last Item Added

Dec 14, 2004

Not 100% sure how to do this so I would appreciate some directions. I have 2 tables, Systems and Contacts. A system can have 1 to infinite contacts and contact can have 1 to infinite systems. So I use a 3rd table Sys_Con to add the contact needed for each system.
Now my question is once I add the System and contact how do I know for sure which ContactID to add in my Sys_Con table? Because while I am doing this operation maybe someone can add an other contact. So is there a way for my store proc Add_Contact to return the contactID needed for my store proc Add_Sys_Con ?

TABLE Sys_Con
SystemID int
ContactID int

Table Contact
ContactID int Identity
ContactName
...

Table System
SystemID
...

View 3 Replies View Related

Delete Last Added Row -how To

Jul 23, 2005

hi i have a question how can i delete last added row. I have 2 tables .source and destination . I take a 1 row from source table , do someoperation on it and save to destination table . after succesfull written Iwant to delete added row from source table.. i'm using a coursors. the mainproblem is : is there any function to check which row was last added. Now Iam doing it using select * from destionation where (and necessaryconditions). but if destination table will be 100000000 rows for example ittakes too much time... Is there another possibility to do it ???please helpMarcin Wolkuwolku

View 2 Replies View Related

Can't See Added Columns In ASPNETDB.mdf

Sep 27, 2006

In developing a VWDE project I added 2 columns to the User table in the ASPNETDB.mdf database.  I can see the columns in the Data Definition and I can see the values I added when I Show Table Data but I cannot access them with a SQLDataSource control?   The SQLDataSource shows all of the columns in that table except the ones I added.  Any suggestions? Thanks.

View 2 Replies View Related

Retrieve The ID Of The Record Just Added

Dec 12, 2003

I would like to retreive the identity field value of a record that was just added to the table.

In other words, I have a form and on submission, if it is a new record, I would like to know the identity value that the SQL Server has assigned it.

This may be overkill, but here is my code to process the form:

Protected Sub processForm(ByVal thisID As String, ByVal myAction As String)
Dim sqlConn As New SqlConnection(ConfigurationSettings.AppSettings("connectionString"))
sqlConn.Open()
Dim sql As String
Select Case myAction
Case "save"
If thisID > 0 Then
sql = "update INCIDENT set " & _
"RegionID = @RegionID, " & _
"DistrictID = @DistrictID, " & _
"DateReported = @DateReported, " & _
..CODE...
"WHERE IncidentID = " & myIncidentID
Else
sql = "insert into INCIDENT(" & _
"RegionID, " & _
"DistrictID, " & _
"DateReported, " & _
...CODE...
") " & _
"values(" & _
"@RegionID, " & _
"@DistrictID, " & _
"@DateReported, " & _
...CODE...
")"
End If
Case "delete"
sql = "delete from INCIDENT where IncidentID = " & myIncidentID
Case Else
End Select

Dim sqlComm As New SqlCommand(sql, sqlConn)
sqlComm.Parameters.Add(New SqlParameter("@RegionID", SqlDbType.NVarChar))
sqlComm.Parameters.Add(New SqlParameter("@DistrictID", SqlDbType.NVarChar))
sqlComm.Parameters.Add(New SqlParameter("@DateReported", SqlDbType.NVarChar))
...CODE...

sqlComm.Parameters.Item("@RegionID").Value = ddRegionID.SelectedValue
sqlComm.Parameters.Item("@DistrictID").Value = ddDistrictID.SelectedValue
sqlComm.Parameters.Item("@DateReported").Value = db.handleDate(txtDateReported.SelectedDate)
...CODE...

Dim myError As Int16 = sqlComm.ExecuteNonQuery
'Response.Redirect("incident.aspx?id=" & )
End Sub

The response.redirect at the end of the sub is where I would like to put the identity field value.

View 6 Replies View Related

How Many Triggers Can Be Added In A Table

Jan 4, 2006

How many triggers can be added in a table?

View 2 Replies View Related

Emailing After A Record Has Been Added

Jan 8, 2008

Hi,
Is there a built in capability with sql server 2005 which sends emails to users upon a record insertion.
Thanks

View 2 Replies View Related

Sp To Email Me If No Records Added

Mar 30, 2008

is there a way to set up a scheduled sp to email me if no records are added to a certain table within the hour?

is this possible?

View 1 Replies View Related

SET FMTONLY Being Added To In-line SQL

Jul 23, 2005

Here's the deal.I've been working on an Intranet application for my clients, and todayI went and installed the first prototype. It's a fairly standard thing- VS2003 ASP.NET/VB.NET on a SQL Server 2000 database.I restored the database onto their db server, and installed theapplication on their intranet server, and made the necessary changes tothe web.config and other configuration files.I logged on with no problem. The default form is a Search/Finder formwith no default recordset. I fired up the filter to return all therecords and the thing crashed. The filter form wouldn't get any data(there *was* data in the database - I checked that!). So I set a traceon the database and this is the SQL that was being sent to the server(note that this SQL is dynamically built and is being sent in-line):SET FMTONLY OFF; SET FMTONLY ON;SELECT fldID, fldReferenceNumber,fldRevision, fldPartNumber, fldIndentNumber, fldDescription,fldBatchNumber, fldCreatedDate FROM tblMyTable SET FMTONLY OFF;Note those SET FMTONLY OFF; SET FMTONLY ON;...SET FMTONLY OFF;directives. These direct SQL Server to return only metadata, and notdata rows. The SQL which SHOULD have been sent, and which I have justcaptured in the SQL Profiler on MY system here is:SELECT fldID, fldReferenceNumber, fldRevision, fldPartNumber,fldIndentNumber, fldDescription, fldBatchNumber, fldCreatedDate FROMtblMyTableWHERE (((tblMyTable.fldReferenceNumber LIKE N'%')))Again, note that the WHERE clause is missing from the first lot of SQL.Does anyone have any ideas about why this might be happening? I thinkit might have something to do with ownership/permissions, but Icouldn't find anything different about this database than the system onwhich this new application was modelled, which has no such problems.Edward

View 3 Replies View Related

Unique ID Added To A Result Set

Oct 5, 2005

Hello all, i have a question i've beenk thinking for a little bit andcant seem to come up with a solution. What i want to do is add a uniquecounter to a resultset in query. For exampleSELECT ColumnA, ColumnB, ColumnC, ColumnDFROM AnyCombinationOfJoinsOrTablesWHERE SomeConditionIsTruewThe query above will produce a resultest of 4 columns.'A1', 'B1', 'C1', 'D1''A2', 'B2', 'C2', 'D2''A3', 'B3', 'C3', 'D3'......'An', 'Bn', 'Cn, 'Dn'Now what i want to do is add a unique identifier to every row. Theeasiest way would be to add a counter integer so the resultset wouldlook like1, 'A1', 'B1', 'C1', 'D1'2, 'A2', 'B2', 'C2', 'D2'3, 'A3', 'B3', 'C3', 'D3'......n, 'An', 'Bn', 'Cn, 'Dn'Is there a way to achieve this in T-SQL without using cursors.Thanks,Gent

View 3 Replies View Related

Added Two More User Parameters

Sep 14, 2007



I have a stored procedure that works fine in reporting services. It grabs the total of Yes's and No's by dates . But then i went ahead and added 2 more parameters to the proc, and now the totals are all wrong. I dont understand how that can mess everything up. Here is the previous stored proc, that gives the correct sum.





Code Snippet
ALTER PROCEDURE [dbo].[Testing_Questions_ALL_YESOrNO]
@Question char(80)
AS
BEGIN

SELECT
Qry_Questions.Question
, Qry_Questions.Date
, Qry_Questions.response
, B.Total
FROM Qry_Questions
INNER JOIN Qry_Sales_Group
ON dbo.Qry_Questions.sales_person_code COLLATE SQL_Latin1_General_CP1_CI_AS = dbo.Qry_Sales_Group.SalesPerson_Purchaser_Code
INNER JOIN
( Select COUNT(qq.response)as Total, Question, Date, response
FROM Qry_Questions qq
Where qq.response in ('Yes','No')
GROUP by qq.[Question] , qq.Date,qq.response ) B
ON Qry_Questions.Date = B.Date AND
Qry_Questions.Question =B.Question and
Qry_Questions.response=B.response
WHERE Qry_Questions.[Response Type]='YesNo' and Qry_Questions.Question=@Question
GROUP BY Qry_Questions.question,Qry_Questions.Date,Qry_questions.Response,B.Total
ORDER BY Qry_Questions.Question, Qry_Questions.Date


END
SET NOCOUNT OFF


Here is the edited version which only has two new parameters added to the proc. The edits are highlighted.



Code Snippet
ALTER PROCEDURE [dbo].[Testing_Questions_ALL_YESOrNO_Totals]
(@Region_Key int=null,@QuestionCode char(5),@Question char(80))
AS
BEGIN

SELECT
Qry_Questions.Question
, Qry_Questions.Date
, Qry_Questions.response
, B.Total
FROM Qry_Questions
INNER JOIN Qry_Sales_Group
ON dbo.Qry_Questions.sales_person_code COLLATE SQL_Latin1_General_CP1_CI_AS = dbo.Qry_Sales_Group.SalesPerson_Purchaser_Code
INNER JOIN
( Select COUNT(qq.response)as Total, Question, Date, response
FROM Qry_Questions qq
Where qq.response in ('Yes','No')
GROUP by qq.[Question] , qq.Date,qq.response ) B
ON Qry_Questions.Date = B.Date AND
Qry_Questions.Question =B.Question and
Qry_Questions.response=B.response
WHERE Qry_Questions.[Response Type]='YesNo'
AND REGION_KEY=@Region_Key
AND LEFT(Qry_Questions.[Question Code],2)IN (@QuestionCode)
AND Qry_Questions.Question=@Question
GROUP BY Qry_Questions.question,Qry_Questions.Date,Qry_questions.Response,B.Total
ORDER BY Qry_Questions.Question, Qry_Questions.Date



END
SET NOCOUNT OFF




View 6 Replies View Related

Added /3GB To Boot.ini And OS Will Not Start

Sep 19, 2007

Here is a new one for me. I added the /3GB switch to the boot.ini, restarted the server and now receive a number of messages when the OS tries to load.

Explorer.exe - Application Error
The application failed to initialize properly.

If I click OK the server sits on a blue screen with no information on the screen.

The other messages are the result of me trying to do anything within Task Manager, with the exception of rebooting the server. These messages make sense since Explorer.exe had a problem.

The server has the following configuration.

HP DL580
Windows Server 2003 Enterprise Edition - SP2
SQL Server 2000 Enterprise Edition - SP3a
14GB Memory
(4) dual core procs
PAE is enabled in the boot.ini

If I remove the /3GB the OS starts without a problem. Any suggestions?

Thanks, Dave

View 8 Replies View Related

Starting A VB Routine When A SQL Row Is Added

Jan 3, 2008



I'm running vb 2088 express with SQL express. I have limited VB and very limited SQL knowledge.



I have a VB app that inserts candidate data into the SQL table (called front) all works fine.



I now have a second VB app (separate from the above VB app) that runs at the same time; it does some extra work on the candidate data.



My question is when a new candidate is added to the SQL table, how I can get the second VB app to automatically know that a new record has been inserted (and the record key) and then start the VB subroutine.



I'm unsure if I should look at triggers or stored procedures (or something else) for this task.



Any help or pointers to additional resources would be appreciated.



Thank you!



TJ


View 7 Replies View Related

Returning The Identity Of The Last Value Added...

Nov 20, 2006

Hi All,

I have a createStudent SProc.  When this is called it calls a createContact SProc.  This in turn calls a Create Address Stored procedure.  Now when I create the address, an Identity column automatically creates a new Identity for me.  I need to return this value back to the calling stored procedure.  I know how to return a value and all, however, how to I get the identity just entered (the corresponding identity) reliably?  I know that select MAX <Identity> could suffice in this case, but is flawed as if someone was to add another object near the same time we could get the wrong identity returned...

Thanks heaps

Chris

View 6 Replies View Related







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