Question About Adding New Log In??

Feb 14, 2005

I hope I can explain this.......
I restored a database "GIM" from server 1 to server2. That went OK. However, there is user A on server 1 who has db_owner access to database "GIM". After the restore, I
add user A on server 2 and try to give him db_access to
database "GIM".

I got the error message saying that "User A already
exists in server2". But user A was not there.

What did I do wrong? Thank you for your suggestions.

View 2 Replies


ADVERTISEMENT

Reporting Services :: Adding All Columns To Table Without Adding One By One

Sep 3, 2015

Is there any way or option to get the all columns of dataset added to table when we add a table in data region. It will take lot of time to add one by one and also there are chances to add one column ore than once.

View 7 Replies View Related

Adding Column Where Adding Year To Date In Date Format

Aug 6, 2013

What is the syntax for adding a column where you are adding a year to a date in a date format? For example adding a column displaying a year after the participation date in date format?

View 1 Replies View Related

Adding Sql Db

Jan 2, 2007

hey i have a very simple form here: www.syscpupower.com
 I would like to have the information from the form saved to a sql db with a time stamp.
here is the code i have for the page below:"C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

"-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
"server">



"form1" runat="server">

 
"z-index: 108; left: 0px; position: absolute; top: 189px">
 
"z-index: 109; left: 204px; width: 411px; position: absolute; top: 18px;
height: 160px">
"3" rowspan="3" style="text-align: center"> Please accept to view your detailed trip information.
"Button1" runat="server" OnClick="Button1_Click" Style="z-index: 102;
left: 322px; position: absolute; top: 261px" Text="Accept" Width="60px">
"Button2" runat="server" OnClick="Button2_Click" Style="z-index: 103;
left: 392px; position: absolute; top: 261px" Text="Decline" Width="64px">
"Label1" runat="server" Style="z-index: 104; left: 254px; position: absolute;
top: 198px" Text="Please Enter Your First and Last Name!" Width="273px">
"TextBox1" runat="server" Style="z-index: 105; left: 278px; position: absolute;
top: 229px" Width="216px">
"RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1"
ErrorMessage="FirstName LastName" Font-Size="12px" Style="z-index: 106; left: 500px;
position: absolute; top: 229px">*
"ValidationSummary1" runat="server" Style="z-index: 110;
left: 263px; position: absolute; top: 300px" Width="284px">

View 5 Replies View Related

Adding A Value In One Row To A Value In The Next Row.

Nov 27, 2007

Hello








A
B
C
D

1
230
40
190
190

2
470
194
276
466

3
376
328
48
514

4
558
340
218
732

5
447
483
-36
696

6
218
357
-139
557

7
395
414
-19
538

8
264
375
-111
427

9
214
285
-71
356

10
218
251
-33
323

In the above table I am looking to replicate column D in sql, columns A,B and C are already generated by the sql.

D is currently done in Excel using =D1 + C2 which is in spot D2.

Can this be done in sql? Does anyone have an example. I am looking to do it in a select query if possible.

Thanks

View 3 Replies View Related

Adding Sql Parameter In VB

Oct 16, 2006

I have a details view with several parameters set up in my asp.net 2.0 code, I want to add a parameter before the sql parameter is executed. I need to use the find control of the details view because I am using items/edit item templates in my details view control. I tried this(see below) as well as the detailsview item command event args to no avail. It doesn't see the other parameters that have already been declared in my asp.net code. I don't want to have to declare all my varibles that are already in my asp.net code. I just want to add another parameter.  Sub InsertNew(ByVal sender As Object, ByVal e As DetailsViewInsertEventArgs) _    Handles dvEvents.ItemInserting        Dim dvr As DetailsViewRow        For Each dvr In dvEvents.Rows  Dim CatIDup As Integer = CType(dvr.FindControl("ddlCat"), DropDownList).SelectedValue            sdsevents.InsertParameters.Add("evCatID", CatIDup)sdsevents.Insert()

View 4 Replies View Related

Adding An Image To SQL

Dec 4, 2006

Looking for any help someone can offer on adding an image to SQL.Working on what will hopefully be quite a big site and the user will be asked for some details, one of which will be an image (jpg, gif or bmp).Rather than add the image to a folder on the server, a folder which could end up being quite large, I was hoping someone could give me some help, suggestions or even point me towards a tutorial on how to store the image in an SQL database.Any helps appreciated, thanks :)

View 2 Replies View Related

Adding To 2 Different Tables

Apr 19, 2007

Hi Everyone,
I have a page with a textbox and a dropdown list. The user will enter a company name in the text box and select a number from 1 - 20 (number of delegates for that company) in the dropdown list.
I've got the text box and dropdown writing to tblCompany but I would also like it to write to tblUsers at the same time. The reason for this is that i need it to set up the number of users that have been selected in the dropdown list.
Here is the codebehind file:Imports System.Data.SqlClient
Imports System.Web.Configuration

Partial Class cms_Management_Company_NewCompany
Inherits System.Web.UI.Page

Dim companyName As String
Dim companyActive As Boolean
Dim companyArchived As Boolean
Dim companyDelegates As Integer

Dim userForeName As String
Dim userSurname As String
Dim userEmail As String
Dim userUsername As String
Dim userPassword As String
Dim userActive As Boolean
Dim userTypeID As Integer
Dim companyID As Integer

Dim i As Integer
Dim NoLoops As Integer

Protected Sub btnSave_Click(ByVal sender As Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnSave.Click
Dim conString As String = WebConfigurationManager.ConnectionStrings("General").ConnectionString

Dim con As New SqlConnection(conString)
Dim cmd As New SqlCommand("INSERT INTO tblCompany (CompanyName, CompanyActive, CompanyArchived, CompanyDelegates) VALUES (@CompanyName, @CompanyActive, @CompanyArchived, @CompanyDelegates)", con)

cmd.Parameters.AddWithValue("@CompanyName", companyName)
cmd.Parameters.Item("@CompanyName").Value = txtCompanyName.Text

cmd.Parameters.AddWithValue("@CompanyDelegates", companyDelegates)
cmd.Parameters.Item("@CompanyDelegates").Value = lstDel.SelectedValue

cmd.Parameters.AddWithValue("@CompanyActive", companyActive)
cmd.Parameters.Item("@CompanyActive").Value = True

cmd.Parameters.AddWithValue("@CompanyArchived", companyArchived)
cmd.Parameters.Item("@CompanyArchived").Value = False

Using con
con.Open()
cmd.ExecuteNonQuery()
con.Close()
End Using

Dim con2 As New SqlConnection(conString)
Dim cmd2 As New SqlCommand("INSERT INTO tblUsers (UserForeName, UserSurname, UserEmail, UserUsername, UserPassword, UserActive, UserTypeID, CompanyID) VALUES (@UserForeName, @UserSurname, @UserEmail, @UserUsername, @UserPassword, @UserActive, @UserTypeID, @CompanyID)", con2)

cmd2.Parameters.AddWithValue("@UserForeName", userForeName)
cmd2.Parameters.Item("@UserForeName").Value = "First Name - Delegate 1"

cmd2.Parameters.AddWithValue("@UserSurname", userSurname)
cmd2.Parameters.Item("@UserSurname").Value = "Surname - Delegate 1"

cmd2.Parameters.AddWithValue("@UserEmail", userEmail)
cmd2.Parameters.Item("@UserEmail").Value = "Email Address - Delegate 1"

cmd2.Parameters.AddWithValue("@UserUsername", userUsername)
cmd2.Parameters.Item("@UserUsername").Value = "Username - Delegate 1"

cmd2.Parameters.AddWithValue("@UserPassword", userPassword)
cmd2.Parameters.Item("@UserPassword").Value = "Password - Delegate 1"

cmd2.Parameters.AddWithValue("@UserActive", userActive)
cmd2.Parameters.Item("@UserActive").Value = True

cmd2.Parameters.AddWithValue("@UserTypeID", userTypeID)
cmd2.Parameters.Item("@UserTypeID").Value = 2

cmd2.Parameters.AddWithValue("@UserTypeID", userTypeID)
cmd2.Parameters.Item("@UserTypeID").Value = 1

Using con2
con2.Open()
For i = 1 To NoLoops
cmd2.ExecuteNonQuery()
Next i
con2.Close()
End Using

Response.Redirect("~/cms/Management/Company/Company.aspx")
End Sub

End ClassThe other thing I am not sure of is getting the ID of the new company and assiging it to the delegates in tblUsers (to associate them with the new company)I hope this makes sense.Thank you very much guys.Scott.

View 2 Replies View Related

Adding Value In A Query

Aug 25, 2007

I am trying to insert a value numeric + 1 in to db table but i get error when i do this
this is the code
Const SQL As String = "INSERT INTO [PageHits] ([DefaultPage]) VALUES (@defaultP)"Dim myCommand As New Data.SqlClient.SqlCommand(SQL, myConnection)myCommand.Parameters.AddWithValue("@DefaultP" + "1", DefaultP.Text.Trim())
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
The Error:  
Must declare the variable '@defaultP'.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: Must declare the variable '@defaultP'. 
 

View 1 Replies View Related

Adding In A Query

Sep 14, 2007

i want to add vales in a query
this is my scenario (how can i add the price column values and display as one record) ex. 222  17
table = table1
tep1  price (column)
222     5
222     2
222     10
 

View 2 Replies View Related

Adding A New Row To SQL Table

Oct 2, 2007

Hi all,
I have a database setup with a few rows and i would like to allow a user to create a new row of data. After some googling, I've deduced that I need to somehow use an onclick command to perform an insert command. here is my code as of right now:
 protected void ItemAdd_Click(object sender, EventArgs e)
{int newnum = 4;int POnum = newnum ++;
 
 string Item = textbox3.Text.ToString();
string Quantity = textbox4.ToString();string Part = textbox5.ToString();
string Description = textbox6.Text.ToString();string Price = textbox7.Text.ToString();string UOM = textbox8.Text.ToString();
SqlDataSource2.InsertParameters.Clear();
SqlDataSource2.InsertParameters.Add("@Item", Item);SqlDataSource2.InsertParameters.Add("@Quantity", Quantity);
SqlDataSource2.InsertParameters.Add("@Part", Part);SqlDataSource2.InsertParameters.Add("@Description", Description);
SqlDataSource2.InsertParameters.Add("@Price", Price);SqlDataSource2.InsertParameters.Add("@UOM", UOM);
SqlDataSource1.InsertCommand = "insert into ItemMaster "+"values (12, @Item, @Quantity, @Part, @Description, @Price, @UOM)";
SqlDataSource2.Insert();
 
 
}
 
here's the aspx:
 
<%@ Page Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="createpo.aspx.cs" Inherits="Subpgs_Purchasing_createpo" Title="Create A PO" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table style="width: 600px; position: relative; top: 30px; height: 253px" cellpadding="10px">
<tr>
<td style="width: 180px; text-align: left;" rowspan="2">
Select Vendor<br />- or -<br /><asp:LinkButton ID="Linkbutton1" runat="server" OnClick="Linkbutton1_Click">Create Vendor</asp:LinkButton></td>
<td style="width: 100px" rowspan="2">
<asp:ListBox ID="ListBox2" runat="server" DataSourceID="SqlDataSource1" DataTextField="Name"
DataValueField="ID" OnSelectedIndexChanged="ListBox2_SelectedIndexChanged"></asp:ListBox><asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT * FROM [Vendor_info]"></asp:SqlDataSource>
</td>
<td style="width: 180px; text-align: left;">
Job/Req.S.O. No.</td>
<td style="width: 100px">
<asp:TextBox ID="Job" runat="server"></asp:TextBox></td>
</tr>
<tr>
 
<td style="width: 180px; text-align: left;">
Terms</td>
<td style="width: 100px">
<asp:TextBox ID="Terms" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 180px; text-align: left;">
F.O.B.</td>
<td style="width: 100px">
<asp:TextBox ID="FOB" runat="server"></asp:TextBox></td>
<td style="width: 180px; text-align: left;">
Ship To:<br />
Address:<br />
City / State / Zip:</td>
<td style="width: 100px">
<asp:TextBox ID="Ship1" runat="server"></asp:TextBox>
<asp:TextBox ID="Ship2" runat="server"></asp:TextBox>
<asp:TextBox ID="Ship3" runat="server"></asp:TextBox></td>
</tr>
</table>
 
<br />
<br />
<asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="Data Source=.SQLEXPRESS;AttachDbFilename=|DataDirectory|Purchase_Orders.mdf;Integrated Security=True;User Instance=True;Context Connection=False"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT [Item], [Quantity], [Part], [Description], [Price], [UOM], [Ammount], [PONumber] FROM [ItemMaster]" DeleteCommand="DELETE FROM [ItemMaster] WHERE [PONumber] = @PONumber" InsertCommand="INSERT INTO [ItemMaster] ([Item], [Quantity], [Part], [Description], [Price], [UOM], [Ammount], [PONumber]) VALUES (@Item, @Quantity, @Part, @Description, @Price, @UOM, @Ammount, @PONumber)" UpdateCommand="UPDATE [ItemMaster] SET [Item] = @Item, [Quantity] = @Quantity, [Part] = @Part, [Description] = @Description, [Price] = @Price, [UOM] = @UOM, [Ammount] = @Ammount WHERE [PONumber] = @PONumber">
<DeleteParameters>
<asp:Parameter Name="PONumber" Type="Decimal" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="Item" Type="String" />
<asp:Parameter Name="Quantity" Type="Decimal" />
<asp:Parameter Name="Part" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Price" Type="Decimal" />
<asp:Parameter Name="UOM" Type="String" />
<asp:Parameter Name="Ammount" Type="Decimal" />
<asp:Parameter Name="PONumber" Type="Decimal" />
</UpdateParameters>
<InsertParameters>
<asp:Parameter Name="Item" Type="String" />
<asp:Parameter Name="Quantity" Type="Decimal" />
<asp:Parameter Name="Part" Type="String" />
<asp:Parameter Name="Description" Type="String" />
<asp:Parameter Name="Price" Type="Decimal" />
<asp:Parameter Name="UOM" Type="String" />
<asp:Parameter Name="Ammount" Type="Decimal" />
<asp:Parameter Name="PONumber" Type="Decimal" />
</InsertParameters>
</asp:SqlDataSource>
<br />
<table>
<tr>
<td>Item #</td>
<td><asp:TextBox ID="textbox3" runat=server></asp:TextBox></td>
<td>Quantity</td>
<td><asp:TextBox ID="textbox4" runat=server></asp:TextBox></td>
<td>Part Number</td><td><asp:TextBox ID="textbox5" runat=server></asp:TextBox></td>
</tr>
<tr>
<td>Description</td>
<td><asp:TextBox ID="textbox6" runat=server></asp:TextBox></td>
<td>Unit Price</td>
<td><asp:TextBox ID="textbox7" runat=server></asp:TextBox></td>
<td>Unit of Measure</td>
<td><asp:TextBox ID="textbox8" runat=server></asp:TextBox></td>
</tr>
<tr>
<td colspan="6" align="center"><asp:Button ID="ItemAdd" runat=server text="Add Item" OnClick="ItemAdd_Click" /></td>
</tr>
</table>
&nbsp;<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PONumber"
DataSourceID="SqlDataSource2">
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="Item" HeaderText="Item" SortExpression="Item" />
<asp:BoundField DataField="Quantity" HeaderText="Quantity" SortExpression="Quantity" />
<asp:BoundField DataField="Part" HeaderText="Part" SortExpression="Part" />
<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price" />
<asp:BoundField DataField="UOM" HeaderText="UOM" SortExpression="UOM" />
<asp:BoundField DataField="Ammount" HeaderText="Ammount" SortExpression="Ammount" />
<asp:BoundField DataField="PONumber" HeaderText="PONumber" ReadOnly="True" SortExpression="PONumber"
Visible="False" />
</Columns>
</asp:GridView>
<br />
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Submit Data" OnClick="Button1_Click" />&nbsp;<br />
<br />
<asp:Label ID="Label1" runat="server" Text="Please Verify Information below!" Visible="False"></asp:Label><br />
<br />
<table align="left">
<tr>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label4" runat="server" Text="Job/REQ.S.O. No." Visible="false"></asp:Label></td>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label5" runat="server"></asp:Label></td>
</tr>
<tr>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label7" runat="server" Text="Terms" Visible="false"></asp:Label></td>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label8" runat="server"></asp:Label></td>
</tr>
<tr>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label10" runat="server" Text="F.O.B." Visible="false"></asp:Label></td>
<td style="width: 200px; text-align: left;">
<asp:Label ID="Label11" runat="server"></asp:Label></td>
</tr>
</table>
 
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" DataSourceID="SqlDataSource1"
Height="50px" Visible="False" Width="260px" BackColor="#CCCCCC" BorderColor="#999999" BorderStyle="Solid" BorderWidth="3px" CellPadding="4" CellSpacing="2" DataKeyNames="ID" ForeColor="Black">
<FooterStyle BackColor="#CCCCCC" />
<EditRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="White" />
<PagerStyle BackColor="#CCCCCC" ForeColor="Black" HorizontalAlign="Left" />
<Fields>
<asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True" SortExpression="ID" />
<asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
<asp:BoundField DataField="Street" HeaderText="Street" SortExpression="Street" />
<asp:BoundField DataField="City" HeaderText="City" SortExpression="City" />
<asp:BoundField DataField="State" HeaderText="State" SortExpression="State" />
<asp:BoundField DataField="Zip" HeaderText="Zip" SortExpression="Zip" />
<asp:BoundField DataField="Telephone Number" HeaderText="Telephone Number" SortExpression="Telephone Number" />
<asp:BoundField DataField="Contact Information" HeaderText="Contact Information"
SortExpression="Contact Information" />
<asp:BoundField DataField="E-mail address" HeaderText="E-mail address" SortExpression="E-mail address" />
<asp:BoundField DataField="Fax Number" HeaderText="Fax Number" SortExpression="Fax Number" />
<asp:BoundField DataField="Comments" HeaderText="Comments" SortExpression="Comments" />
</Fields>
<HeaderStyle BackColor="Black" Font-Bold="True" ForeColor="White" />
</asp:DetailsView>
<br />
<br />
<br />
<asp:Button ID="Button2" runat="server" Text="E-Mail PO" Visible="False" OnClick="Button2_Click" />
 
 
 
</asp:Content>
 
whenever I run this, I receive the following error and am not sure how to correct it:
 
System.Data.SqlClient.SqlException: Must declare the scalar variable "@Item".
 
If someone could please explain to me the process here of what is going ion it would be greatly appreciated.  My understanding is the @item is just a variable if you will so i'm not sure why its stating i need to declare it.
 
Thank you all!
 

View 4 Replies View Related

Adding An Int To A SQL Database Using C#

Feb 17, 2008

Hi Guys,
I know this is a little off the subject of ASP.net but I am using some code behind in C#.  I am a real novice at this and so it may appear to be a simple question but Im trying to add a number to the database from a textbox but it is having issues as the Storenum is an int and it wants a string.  Can anyone help?  I know I need to write .tostring somewhere but can't work out where.  My code is below.
Thanks in advance. =)
public partial class _addstore : System.Web.UI.Page
{protected string Location;
protected string Telephone;protected string Prefix;
protected int StoreNum;protected string myConnectionString;protected void Page_Load(object sender, EventArgs e)
{
Location = "default";Telephone = "default";
Prefix = "default";StoreNum = "0";myConnectionString = "Data Source=.\SQLEXPRESS;AttachDbFilename=C:\inetpub\wwwroot\HOF\App_Data\HOF.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True;";
 
}protected void Button1_Click(object sender, EventArgs e)
{int sa;
SqlConnection myConnection = new SqlConnection(myConnectionString);
try
{
Location = TextBox2.Text;
Telephone = TextBox3.Text;
Prefix = TextBox4.Text;
StoreNum = TextBox5.Text;SqlCommand myCommand = new SqlCommand("INSERT INTO StoreInfo (StoreID, Location, Telephone, Prefix) Values (" + StoreNum + ", '" + Location + "', '" + Telephone + "', '" + Prefix + "')", myConnection);SqlDataAdapter myDataAdapter = new SqlDataAdapter(myCommand);
myConnection.Open();
sa = myCommand.ExecuteNonQuery();
myConnection.Close();
}catch (Exception ex)
{
TextBox2.Text = ex.Message;
myConnection.Close();
}
}
}

View 3 Replies View Related

Adding Foreign Key

Apr 7, 2008

tell me how to add foreign keys in sql 2005 express

View 3 Replies View Related

Adding Images In SQL

May 3, 2008

I am trying to create a sql database that will have a table with the following parameters.  ID, Name, Picture.  So i create the table and set the ID to an int the Name to an nvchar and the Picture to an image.  My question is now how to i add a picture to this database.  When i rightclick on the table and click show table data and attempt to add an image all i can type in is text.  Thank you for your help 

View 8 Replies View Related

Adding New Column

May 5, 2008

Hi,I have an application up and running. I need to add a new column to one of the tables which is currently being used - would adding a new column change or cause errors in the current application? e.g. if the table is being accessed by selecting * from table, will adding a new column cause an error? If there is any circumstance where an error would be caused by adding a new column, I will have to create an entirely new table. If I have to do this - how do I get a column in the new table to have the same values as a column in the old table? Can I create a computed column where column=oldcolumn? Thanks,Jon 

View 5 Replies View Related

Adding VbLf

May 11, 2004

When using the Xp_sendmail stored procedure from MS SQL 2000, I cannot use LF or CR of both otr VBnewLine in my messages.

For example

<code>
Trim(lblEmployee.Text) & " has requested a holiday. From " & CalendarPopupStartDate.SelectedDate & " till " & CalendarPopupStartDate.SelectedDate _
& "." & CARRIAGE RETURN WANTED &lblRequestedDays.Text & txtComments.Text
<code>

where you find the CARRIAGE RETURN WANTED, I want to begin a new line. My email is not formated asked :(

any help?

Greetz,
Geoff

View 5 Replies View Related

Adding Or Subtracting

Jul 28, 2004

I'm in trouble. I have a table with some fields, one of them is an amount of money.
One field indicates whether the amount is negetive or positive. This fields has only two possible values, 'N' and 'R'. 'N' means the amount is negative and 'R' means the amount is positive.

The problem I have is that I have to sum these amounts to give a total for each customer and report them as

customer1 total amount1
customer2 total amount2

I don't know how to make a query to bring these results. I know that sum would bring me the total amount for each customer but I don't know how to specify which fields are supposed to be negative so that it subtracts them instead of adding them.

By the way I'm not allowed to change the structure of the table.

Could you help me try to create this query?

View 2 Replies View Related

Adding Dates In SQL

Dec 22, 2004

I am trying to pull only records that are greater than 1 month prior to today's date. This is what I have so far....


select *
from MyTable
where eventDateStart > '$Now'
order by eventDateStart


$Now is a variable that pulls in today's date. This sql statement delivers only records that have a eventDateStart greater than today. My problem is I do not know how to make it so it only shows records that are 1 month prior.

Any idea how to do this?

View 4 Replies View Related

Adding A New Database

Mar 13, 2005

Hi, I am so very new at using asp and my problem is that i have created a new access database and I am unable to connect to it. I am using the desktop engine and I can connect to all the sample database's fine. I've tried using the osql statments at the command prompt and after I am granted login and try to grant access to my new database called 'Assets' it tells me that i do not have access or permission to this database. If anyone can help me I would so so appreciate it (I need idiot instructions :) ).

View 2 Replies View Related

Adding Records

Jul 8, 2005

HiHow do i simply add records to my Ms SQL database??Does anyone have an example?Best regards/Erik

View 1 Replies View Related

Adding Users To SQL 7

May 25, 2001

Have small network of NT workstations, A PDC and BDC. We have one SQL database on the PDC and two others on the BDC. I added a new machine to the network, added users to that machine. When I try to add the new user, (Not Machine) to the database on the BDC, using security, add new user, I get the following message: Microsoft SQL-DMO ( ODBC SQL Statement 42000)
Error 15401: Windows NT user or group "domainnameusername" not found Check the name again.

The user 01 is listed on both the PDC and the BDC. I am totally baffled by this. Any help would be appreciated.

Stephen

View 1 Replies View Related

How Can I Specify A Name When Adding A Primary Key?

Aug 30, 2001

Im using

ALTER TABLE mytable ADD PRIMARY KEY(mycolumn)

I want to use a specific name like PK_mycolumn, how the heck is this done?

thanks!

View 2 Replies View Related

Adding 3 Gig Switch

Dec 12, 2002

Hi,

We have a standard Win 2K server and SQL2000 Enterprise edition on our DELL server.

Will it be possible to add a /3 Gig switch to boot.ini and make sql server to use 3 gig of RAM and the OS with 1 Gig of RAM.

This a live server website with heavy transactions more than 100 Transactions per minute.

We are planning to do a Transactional replication against 4 databases (publisher) with remote ditributor.

The reason why I am asking about this RAM increase is for this replication. Or is it Ok to have the 2 Gig RAM for this environment +replication.

Please give me a suggestion, how to proceed with this issue as i am concerned about memory especially for replication.

(4 Database sizes are 20 gig,7 gig,5 gig,5 gig)

Thanks,
Anu

View 10 Replies View Related

Performance After Adding 4 CPU's

Mar 19, 2003

Has anyone come across problems after upgrading a Server and adding CPU's. We had 4 originally, with 4GB RAM, the CPU's were 100% with some queries, we added an additional 4 CPU's and the support guys 'did something else'. (I think they actually installed some service Packs on Win2000).

Performance seems to have gone down since the upgrade.

Any ideas ?

View 8 Replies View Related

Adding NT User Id To SQL 6.5

Aug 12, 1999

Does anyone know how to programmatically do the functions that SQL Security manager is doing when it moves an NT login into SQL?

I want to automate the task of granting NT users the ability to do a trusted SQL connection.

thanks Jeff

View 1 Replies View Related

Adding To Text

Jan 23, 2006

If I have a varchar field, I can easily add to it. For instance
select 'Name: ' + fname as fname from Customers.

But what if I have a text field instead of varchar?

select 'Summary: ' + summary as Summary from Customers won´t work at all.
Is there a way to accomplish this?

View 1 Replies View Related

Adding Integers

Feb 15, 2007

The code below has this line
SET @SOGallons = @ODTGallons

I need it to add the Current value of @SOGallons to the newly selected value of @ODTGallons and set that as the new value of @SOGallons.

I've tried
SET @SOGallons = @SOGallons + @ODTGallons

SET @SOGalTemp = @SOGallons
SET @SOGallons= @SOGalTemp + @ODTGallons

Neither Worked

<CODE>
FROM [CSITSS].[dbo].[Orderdt] as ODT LEFT OUTER JOIN [CSITSS].[dbo].[Orddtcom] as OCOM
ON ODT.[Companydiv] = OCOM.[Companydiv] AND ODT.[OrderNumber] = OCOM.[OrderNumber] AND
ODT.[Sequence] = OCOM.[Sequence] WHERE ODT.[Companydiv]= 'GLPC-TRANS' AND ODT.[OrderNumber] = @OrdNum AND
([LineType] = 'IP' OR [LineType] = 'SO' OR [LineType] = 'DL' OR [LineType] = 'PU')

OPEN TC1

FETCH NEXT FROM TC1 INTO @LT, @ODTGallons, @ODTComm
WHILE @@FETCH_STATUS=0
BEGIN
IF @LT = 'SO'
BEGIN
SET @SplitTest = 1
SET @SOGallons = @ODTGallons
IF @SOGallons > 0
BEGIN
SET @SOGalTest = 1
END
ELSE
BEGIN
SET @SOGalTest = 0
END
IF @SplitTest <> @SOGalTest
BEGIN
SET @SOGalTest = 0
END
END
ELSE
BEGIN
SET @SOGalTest = 1
END
FETCH NEXT FROM TC1 INTO @LT, @ODTGallons, @ODTComm
END
CLOSE TC1
DEALLOCATE TC1</CODE>

View 3 Replies View Related

Help With Adding Column

Jun 15, 2007

hi guys! I have a table with 3 columns but i realized that i need to add 1 column between column 2 and 3. Can anybody please help me on how to do that? Thanks in advance!

View 2 Replies View Related

Adding New Column

Jul 5, 2007

ALTER TABLE BFTITLE ADD COLUMN [RATETYPE] [NUMERIC] (10) NOT NULL ;

syntax is not working so can any one tell the right syntax

View 3 Replies View Related

Adding Columns

Jan 11, 2004

What is the SQL syntax for adding a column to an already created DB table?

View 4 Replies View Related

Adding A Db To My Server

May 18, 2004

I have a ldf and mdf file, i need to add them to my server how do i do this?

View 1 Replies View Related

Adding 0 To Month

Apr 17, 2008

hi,
why does this query display the date as 20084, rather than 200804


SELECT
DATENAME(YEAR,getdate()) + RIGHT('00' + DATEPART(month,getdate()),2)


?

View 9 Replies View Related

Adding A Count

May 23, 2008

Hello,

I have a query that creates a list of values. There are labtestcodes that are assigned to different value codes so for example

labtest code, value code
003277 Height
003277 Hgtunt
003277 TotVol
008300 Height
008300 Hgtunt
008300 TotVol

I want to add a count column to this query that will count the number of value codes in each group so for example

003277 Height 1
003277 Hgtunt 2
003277 TotVol 3
008300 Height 1
008300 Hgtunt 2
008300 TotVol 3

Is there a way to do this in the current query I have?


With labtestcheck (labtestcode)
as
(
selecta.labtestcode
fromEMR_temp_labtest_configupdate a
WhereNot Exists (Select * From lab_test_add_conf b where b.labtest_key = a.labtestcode)
)

selectt.labtestcode,b.zsegcode,b.valuecode,b.valuedesc,b.valuetype,b.units,b.tablename,b.fieldname
fromEMR_temp_labtest_configupdate a
inner joinemr_zseg_code_descriptions b on a.zsegcode = b.zsegcode
inner joinlabtestcheck t on t.labtestcode = a.labtestcode

View 2 Replies View Related







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