Constructing A View Into Time Dependant Data
Oct 18, 2006
1. I have a table with data like this:
PersonID
DateTime
Temperature
Pressure
2. I want to build a view into this table so that it shows up as follows:
PersonID DateTime1 DateTime2 DateTime3 .....
1 Pressure1 Pressure2 Pressure3 ......
1 Temperature1 Temperature2 Tempearture3 .....
2 :
:
how would I do this?
View 5 Replies
ADVERTISEMENT
Apr 4, 2006
Not sure where to post this question so if you can answer this or have a better forum suggestion, please advise:
I have two tables.
Table USACITY has 100 cities with Latitude and Longitude data (Fields=CITY,CITYLAT,CITYLONG). T
Table USAFAC has 12000 facilities with Latitude and Longitude data (Fields=FAC,FACLAT,FACLONG).
I have an expression that I can use to calculate the distance between any city and facility. The resulting field in the view will be DISTANCE.
Resulting view will include CITY, CITYLAT, CITYLONG, FAC, FACLAT, FACLONG, DISTANCE.
The total possible combinations are 1,200,000 however, the dataset that I am interested in will only include city-facility combinations within 150 miles of each other.
I have built 12 databases in Access that I am now in the process of converting to SQL so I am on a rapid learning curve. Any solutions should include code and instructions on creating the view.
Thanks in advance for any help!
Ernie
View 1 Replies
View Related
Dec 27, 2006
Hi,
I am experimenting to make a datatable in C# code in a page. This table should be a disconected table with Only valid for the present session.
I try the following code:
public partial class Default2 : System.Web.UI.Page
{
DataTable DT = new DataTable("TEST");
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
DataColumn Col1 = new DataColumn("Col1");
Col1.DataType = typeof(Int32);
Col1.AllowDBNull = false;
DT.Columns.Add(Col1);
DataColumn Col2 = new DataColumn("Col2");
Col2.DataType = typeof(string);
Col2.AllowDBNull = true;
DT.Columns.Add(Col2);
DataColumn Col3 = new DataColumn("Col3");
Col3.DataType = typeof(DateTime);
Col3.AllowDBNull = true;
DT.Columns.Add(Col3);
GridView1.DataSource = DT;
}
}
protected void Button1_Click(object sender, EventArgs e)
{
for (int i = 1; i < 20; i++)
{
DataRow MyRow = DT.NewRow();
MyRow["Col1"] = i;
DT.Rows.Add(MyRow);
}
}
}
For one reason or the other. if I click the button I get the message that Col1 dus not make part of the table TEST. It turns out that there are no columns added to the table. altroug the code in the page load part has been run. I suppose I have to do something with the session state to make my DataTable persistent, but I have no idea what. Can somebody help me out?
Thanks!
Rob
View 6 Replies
View Related
Oct 12, 2006
This is related to one of my previous posts.
I am running a CLR stored proc that goes to an EDS (Novell) server with LDAP and returns records into a SQL table.
I am using the Novell ldap library.
I want to do this with SSL so my code referneces the Mono security library as well.
However when I make the call to the stored proc to run in SSL, I get an object not found error. I do not think that the the Novell assembly can "find" the Mono assembly.
Two points:
1/ I can do the SSL if I run it as an asp.net page (so I know the SSL works)
2/ The proc runs and pulls all the records in non-SSL (so I know the proc works)
Any ideas?
Thanks,
BIG
View 22 Replies
View Related
Mar 3, 2004
Hi,
I need to construct a stored procedure that will accept a set of comma seperated numbers. What I would like to do is something like this
create procedure shopping_cart(@contents as varchar) as
select dvd_title
from movie_dvd
where dvd_detail_id in (@contents)
dvd_detail_id is defined as int in the table.
The problem is if I declare @contents as varchar, the procedure only recognizes the first number and ignores the others. Does anyone know how to get around this?
Thanks
Dan
View 2 Replies
View Related
Dec 4, 2000
I posted a similar question in the SQL7 forum but am not getting any replys.
"I need to move 65 tables onto their own filegroup. Is there anyway to do this without scripting the tables first and BCP etc? My concern is the dependant stored procedures, I don't want to have to script these also as there are hundreds of them."
If I wanted to drop and recreate some tables, how would I do so without upsetting the dependant stores procedures on these tables?
If I inserted the names into a table and wrote a cursor to pull out the dependant id's from the sysdepends table, then put them back after the drop and recreate (matching the old dependants with the new object ids) what kind of trouble am getting myself into? Thanks Patrick
View 2 Replies
View Related
Sep 28, 2005
I have two tables, both with phone numbers and call times.
one is for incoming calls, one for outgoing calls.
I need to find all phone numbers from the incoming calls table where the number of calls exceeds 100 within the last 30 days, where the last call was within the last 15 mins, and where the number does Not exist in the outgoing call table within the last 30 days.
so far I have this...
(call record is the incoming, callout is the outgoin)
I believe this is giving me all records in the call record table that are within the last month, and not in the outgoing call table OR have not ben called within the last month..
SELECT cr.cli,min(cr.starttime)as "first call",max(cr.starttime)as "last call",count(cr.cli) as "number of calls"
FROM callrecord cr
LEFT JOIN callout co
ON cr.cli = co.cli
where (co.cli is null or datediff(dy,co.calltime,getdate())>30 )
and datediff(dy,cr.starttime,getdate())>30
group by cr.cli
order by cr.cli
i need to add in the 15 minute call check, and also only return those with a count of > 100
can anyone assist? i'm getting a headache :D
tia
a
View 4 Replies
View Related
May 12, 2004
Anyone know if MS-SQL Server supports IDENTITY columns that are incremented for each new value of the column it depends on.
For exameple:
Let's say I have a client table with a ClientID column as it's PRIMARY KEY.
This column can be an auto-incrementing IDENTITY column.
Then I have an orders table. The PRIMARY KEY for the orders table is composed of (ClientID, OrderID). I would like the OrderID to be an IDENTITY field that increments by an arbitrary value (1 in this case) for every new value of ClientID...therefore creating a unique PRIMARY KEY.
The contents of the table would look like this
ClientID OrderID
------- -------
1 0
1 1
2 0
1 2
2 1
2 2
1 3
and so on....
MySQL (and maybe other RDMS's...I haven't checked) seems to do this automatically when you set a column as AUTOINCREMENT and then define a composite PRIMARY KEY on two fields.
I know this can be done manually using triggers, but I was wondering if there was a better way...
Thanks in advance
View 14 Replies
View Related
Jul 23, 2005
Hi,I am constructing a Message (Body) for sending our Emails. It is around3000 characters long. But for whatever reason, the last line seems tobe broken with a "!" exclamatory mark in it, which results indisplaying the constructed image path as a broken one.How to resolve this ?. Thanks.Regards,Karthick
View 3 Replies
View Related
May 22, 2007
Hi friends,please help me in selecting values from the tablethe record is as follows:Id HomePhone WorkPhone Mobile Email20 2323223 323232232 Join Bytes!i have to select values as follows.Id DeviceType DeviceInfo20 HomePhone, Mobile, Email 2323223, 323232232, Join Bytes!the one solution is:select'HomePhone, Mobile, Email' AS DeviceTypeHomePhone + ',' + WorkPhone + ',' + MobilePhone + ',' + Email ASDeviceInfofrom table where Id = 20but here the work phone number is not available so that informationhas to be truncated...Thanks in AdvanceArunkumar.D
View 3 Replies
View Related
Aug 9, 2006
Hi,I have a 2 tables called 1.tblRisk which consists of Ref(pk), subject, status, staff & Dept(fk)2.tblDept which has Ref(Pk) & DepartmentHow do i get it to populate Department, when tblRisk Ref's Dept matches the Ref in tblDept i am using SQL Server 2000best regards
View 1 Replies
View Related
Aug 11, 2006
Hi All,
It seems I have been requested to carry out a complex query and the best way I think I can do this is with the use of a stored procedure. The problem is that I am not quite sure whether my SP is stated correctly and also how I would go about stating the SP in my VB.net code!
I would be ever so grateful if somebody could look over my SP code and possibly recommend a way of stating my code. My ability is limited so I would appreciate it if examples could be used with possible relations to my problem.
The Problem?
Tables:
1.tblRisk: Ref(pk), subject, status(fk), staff(fk), Dept(fk)
2.tblDept: Ref(pk), Department
The SP should state that Department should appear as the end result of the query when the page is loaded. So when a row is selected in tblRisk, dependant upon what the Dept is in that table, it then populates the department in which it is associated with from tblDept. I have left the SP below.
Many Thanks,
Kunal
CREATE PROCEDURE dbo.ShowMe @yourInputValue INTAS SELECT tblDept.Department FROM tblDept JOIN tblRisk ON tblDept.Ref = tblRisk.Dept WHERE tblDept.Ref = @yourInputValue RETURN 0GO
View 1 Replies
View Related
Jan 9, 2007
Hi all,
Sorry if it looks a little cluttered!I have these two tables: CAMPAIGN(MEDIACODE varchar(10) UncheckedSPECIALOFFERCODE varchar(15) UncheckedLAYOUT varchar(10) UncheckedHEADERTEXT varchar(100) CheckedSORTORDER varchar(10) UncheckedSORTORDERCOLUMN varchar(50) UncheckedWIDTH varchar(50) Checked)andPROMORATEVIEW(MEDIACODE varchar(10) CheckedSPECIALOFFERCODE varchar(15) CheckedCAMPAIGNCODE varchar(15) CheckedNUMBEROFISSUES smallint CheckedRATE decimal(9, 0) CheckedDESPATCHMETHODCODE varchar(50) Checked)CAMPAIGN HAS ONLY ONE ROW:(CE DG8398 GRID ASC NUMBEROFISSUES NULL)ANDPROMORATEVIEWTOO MANY AND HERE A VERY SMALL RANGE OF RECORDSMEDIACODE SPECIALOFFERCODE CAMPAIGNCODE NUMBEROFISSUES RATE DESPATCHMETHODCODE(...CE CER1R02 CER1 12 429 WCE CER1R03 CER1 24 829 WCE CER1R03 CER1 12 429 WCE DG8398 DG8398 12 411 FCE DG8398 DG8398 12 405 1CE DG8399 DG8399 12 399 WCE DG8399 DG8399 12 735 1CE DG8399 DG8399 12 756 ACE DG8400 DG8400 12 756 ACE DG8400 DG8400 12 396 W...)Now the question:Why these two OUTER JOINS RETURN the same number of rows in My Sql2000 & 2005 express???1.SELECT DISTINCT P.MEDIACODE, P.SPECIALOFFERCODE,CD.MEDIACODEFROM CAMPAIGN AS CD RIGHT OUTER JOINPROMORATEVIEW AS P ON P.MEDIACODE = CD.MEDIACODE AND P.SPECIALOFFERCODE = CD.SPECIALOFFERCODE2.SELECT DISTINCT P.MEDIACODE, P.SPECIALOFFERCODE,CD.MEDIACODEFROM CAMPAIGN AS CD RIGHT OUTER JOINPROMORATEVIEW AS P ON P.MEDIACODE = CD.MEDIACODE AND P.SPECIALOFFERCODE = CD.SPECIALOFFERCODE AND CD.SORTORDER IS NULLIf you still with me here is what I am trying to do:to right outer join the campaign with promorateview and the if it's not overriden in campaign( there is no record for MEDIACODE, SPECIALOFFERCODE in campaign ) I will use that view to override the default values.I suspect that the last statement makes no "influence" on right outer join.Another work around for me now is that if I create a view that has these values and then filter it with VIEW.SORTORDER IS NULL it does the job but I am trying to get rid of this extra view.Thanks for your time, avarair
View 8 Replies
View Related
Jan 29, 2008
Hi i have a page in which stock can be allocated, there are two boxes which have a product serial number start range and a product serial number end range, when these boxes are filled the "allocate" button is then clicked and the product will then be allocated the serial numbers.
What i want to happen is that when the start and end ranges have been entered into the text boxes it will fail if any number within the range has already been allocated previously. E.g
Start Range
End Range
So lets say in the start range text box 15 is entered and in the end range 25 is entered, however 18 has already been allocated previously, this will then bring up a message saying please select another range;
I have done the following so far;private void ValidateRange()
{
//String strSql;SqlConnection conn = new SqlConnection(ConfigurationManager.AppSettings["strConnectionString"]);
String strSql = "SELECT SqlCommand dbCommand4 = new SqlCommand(strSql, conn);
dbCommand4.Parameters.Add("@Start_RangeID", txt_Start_Range.Text);dbCommand4.Parameters.Add("@End_RangeID", txt_End_Range.Text);
dbCommand4.Connection = conn;
conn.Open();SqlDataReader myDataReader = dbCommand4.ExecuteReader();
myDataReader.Read();if (txt_Start_Range.Text == Convert.ToString(myDataReader["Serial_No"]))
{lblRange.Text = "Please enter a different range a portion of the selected values have already been allocated";
//Response.Redirect("Selectedfilm.aspx");
}
else
{Allocate(true);
}
conn.Close();
}
My problem is constructing the select statement, thanks.
View 1 Replies
View Related
Apr 17, 2008
Hello,
i am trying to subscribe to a report that has dependant parameters, for example Country->City and Year-> Month.
Those values are coming from a Analysis Services cube dimensions.
when i come to it in the subscription window, some of the parameters are populated and some are not.
I cannot detect a pattern.
Does anyone know what can be the problem?
thank you.
View 1 Replies
View Related
Sep 4, 2007
Hi matesI am getting the following error "Invalid object name 't1'.Invalid object name 'relT1T2'." from this line of code " String SQLREL = "SELECT t1.SubCategory2Name, t1.CityName, SubCategory2Name,relT1T2.N FROM " + "t1 INNER JOIN relT1T2 ON t1.PKSUBCAT2ID = relT1T2.FKSUBCAT2ID";"i am basically using datarelation and the relation is working fine and is showing all the data for the parent and child tables but while constructing sql i get above mentioned error.can some one pls help me out. the full code is given below: DataColumn parentCol; DataColumn childCol; parentCol = ds11.Tables["t1"].Columns["PKSUBCAT2ID"]; childCol = ds11.Tables["t2"].Columns["FKSUBCAT2ID"];DataRelation relT1T2; relT1T2 = new DataRelation("T1T2", parentCol, childCol); ds11.Relations.Add(relT1T2); Response.Write(ds11.Tables["t1"].Rows.Count); foreach (DataRow rowParent in ds11.Tables["t1"].Rows) { foreach (DataRow rowChild in rowParent.GetChildRows(relT1T2)) { Response.Write(ds11.Tables["t1"].Rows.Count);//test code DataView dv1 = ds11.Tables["t1"].DefaultView; String SQLREL = "SELECT t1.SubCategory2Name, t1.CityName, SubCategory2Name,relT1T2.N FROM " + "t1 INNER JOIN relT1T2 ON t1.PKSUBCAT2ID = relT1T2.FKSUBCAT2ID"; DataSet ds77 = new DataSet(); SqlConnection cn77 = new SqlConnection(CONN1); cn77.Open(); SqlDataAdapter da77 = new SqlDataAdapter(SQLREL, cn77); da77.Fill(ds77); DataList1.DataSource = ds77.Tables[0].DefaultView; DataList1.DataBind(); cn77.Close();
View 1 Replies
View Related
Jul 13, 2006
Hi! I'm trying to put together some reports for an attorney's office. I'm having trouble constructing this query. What I'm doing is querying for defendants who do not have a particular charge against them.
Here are my tables:
DCase
-------------------------------
VBKey CaseNumber
1 33365
2 66585
etc..
DCharge
-------------------------------
VBKey ChargeNum
1 27
2 19
3 20
3 21
etc..
Since both tables are linked via VBKey, I joined them together and this is where I got stuck.
I tried using HAVING ChargeNum<>21 but it would still return a result b/c VBkey=3 has two charges against him. So, when do my queries, I'm still getting individuals who have multiple charges. I tried doing this with SELECT DISTINCT but it would still give me results from people with 3 or more charges. I'm lost at how to complete this query. Any help will be greatly appreciated! Thank you!
View 3 Replies
View Related
Jul 23, 2005
I have a problem.I should rename some tables which are referenced in numerous storedprocedures.Is there any way to automatically replace old table name with new one in alldependant stored procedures,instead of manual replacement in every stored procedure ehich would betime-consuming?Thank you in advance.
View 4 Replies
View Related
Nov 27, 2007
Hello,
I hope someone can help me on this one, as I am getting a bit frustrated with my research..
I have procA on ServerA.DatabaseA and it uses an input parameter to get a value that determines which server to ping.
If this parameter is @paramA = 1, then query into LinkedSrvX. If @paramB = 2, then query into LinkedSrvY... etc.
Is there an easier way to do this or a best practice? I really don't want to go into repeating my queries for every server. Here is a tsql mini version of what I am trying to enhance as my original queries are 1000 lines long and I need to get away from the repeated queries. I do have queries that ping within the server and to other linked servers as well without issues.
All linked servers referenced below have the same structure of tables. I also need to avoid situations incase the server may be down, this proc should not return errors.
My Partial Procedure
CREATE PROC procA
@paramA varchar(1) AS
IF (@paramA = '1')
BEGIN
SELECT ColA, ColB
FROM LinkedSrvX.Database0.Owner.Table0
END
IF (@paramA = '2')
BEGIN
SELECT ColA, ColB
FROM LinkedSrvY.Database0.Owner.Table0
END
IF (@paramA = '3')
BEGIN
SELECT ColA, ColB
FROM LinkedSrvZ.Database0.Owner.Table0
END
GO
All ideas / suggestions are welcomed.
Thanks!
-Ashvi
View 5 Replies
View Related
Jan 14, 2005
hi.. i'm using sql server 7.0 and visual basic 6.0 to develop a system for a project in one of the module that i'm studying. i've encountered 2 problems here.. hope someone here can help me..
1. this is one of the table in the database..
Create Table RepairRecord
(RR_Id char(10) Not Null,
RDate datetime Not Null,
RTime datetime Not Null,
PartName varchar(20),
PartCost decimal(7,2),
Description varchar(50),
ENG_Id char(10) Not Null,
SA_Id char(10) Not Null,
Primary Key (RR_Id),
Foreign Key (ENG_Id) References Engineer(ENG_Id),
Foreign Key (SA_Id) References ServiceAgreement(SA_Id));
is the attributes highlighted in bold correct? and in RTime, i've declared the datatype as datetime.. but actually i just want it to show only time.. how do i do that?
2. there's a requirement that we need to give our lecturer a soft copy of this whole system. well, just don't want to waste any CD-R, how to burn everything in the cd and it will work fine using the cd itself? i once tried to burn one but can't run cos it said can't find database...
well.. visual basic is the front-end while sql is the back-end..
so, anyone can help??
View 2 Replies
View Related
Apr 26, 2007
I have a query that is taking 30-40sec to execute in a SQL Server 2005 Standard Edition database. However, when I use that same query to create a named view, and then try to open the view, I get the following error (eventually) after I attempt to open the view:
Executed SQL Statement: select ....
Error Source: .net sql data provider
Error Message: Timeout expired. The timeout period elapsed prior to completion of the operation, or the server is not responding.
Is there a server or set parameter that I can adjust that will allow my view to complete execution?
View 2 Replies
View Related
Jun 12, 2015
Currently I have around 4 million records. I have normalized the table the best I know how. I am using SQL Server 2008 r2 express running on a local instance. I am trying to create a view in the View designer. I run the query in query editor it takes just under a minute to run. When I run it in the view designer it times out in 30 sec.
View 3 Replies
View Related
May 22, 2006
Hi!
When I using SQL Server 2005 to buide a Time Series mining model, in the Charts tab, it show the chart about somthing to predict in the future.
How to view that Time Series Chart in C# . ( Or using a third component)
View 5 Replies
View Related
Mar 14, 2008
I'm trying to clean up our report server and prune reports that are no longer in use by our users. Is there a way to find out the last time a report was accessed?
Thanks.
View 1 Replies
View Related
Mar 7, 2006
Hi, I am using sql server 2005 entreprise edition. I am just wondering
when I have a report with parameters and the report uses stored
procedure to retrieve the result set for use in the report, if two
people from different places are trying to view the report at the same
time, and each of them use different set of parameters.
Will they be able to view their report correctly??
View 6 Replies
View Related
Apr 25, 2014
Sample Table
USE [Testing]
GO
/****** Object: Table [dbo].[Testing] Script Date: 4/25/2014 11:08:18 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
[Code] ....
It seems to work fine with one million records.
Each primary key is unique, but the begindate is non-unique, and i guess even if i use datetime2 and add nanoseconds, from what i have read, there is a chance that i could have a duplicate datetime since the date is imported via XML from multiple sources.
View 7 Replies
View Related
Oct 7, 2015
I have a table called employee_punch_record that we use to store employee time clock punches.
The columns are:
employeeid,
punch_timestamp,
punch_type (In / Out),
closed (bit used as status for open or closed pay periods),
ident
Here are some examples of a record:
bkingery62015-10-06 16:59:04.000In0
bkingery72015-10-06 16:59:09.000Out0
bkingery82015-10-06 16:59:13.000In0
bkingery92015-10-06 18:22:44.000Out0
bkingery102015-10-06 18:22:46.000In0
bkingery112015-10-06 18:22:48.000Out0
bkingery122015-10-06 18:22:51.000In0
tfeller52015-10-05 17:00:05.000In0
We are using SQL Server 2008 as our database and use Access as a GUI. I am looking to create a form in Access where employees can access their time card and request changes from management. I want to use the format from the attached screen shot for the form. I pretty much know how to do it all, the only point of complication is trying to figure out the easiest way to get the transaction punch record data on employee_punch_record into a format where I can easily populate the form in the horizontal format you see in the screen shot.
I am not super strong in SQL, but figure I can do it using a formatting table of some sort. quick and easy way to move transaction records into a more horizontally oriented record?
View 0 Replies
View Related
Sep 1, 2006
Good afternoon everyone, I have written a view that pulls customer demographic infomration as well as pulling data from multiple scalar-valued functions. I am using this view to pull and send data from one database to another in the same SQL server. The problem that I am having is that I am running this import as a scheduled job in windows. The job is taking almost 24 hours to complete this task. The total number of records that are being pulled is around 21,000+. I have tried removing the functions from the view and it only takes the view 20 seconds to pull the demographic information from the same 21,000+ records but when I add the function calls this is where the time to complete goes through the roof. Has anyone encountered this before if so what would you suggest doing? Any help would be appreciated. Here is the syntax for my view: SELECT TOP 100 PERCENT CUS_EMAIL AS Email, CUS_CUSTNUM AS MemberID, CUS_PREFIX AS Prefix, CUS_FNAME AS FirstName,
CUS_LNAME AS LastName, CUS_SUFFIX AS Suffix, CUS_TITLE AS Title, CUS_STATE AS State, CUS_COUNTRY AS Country, CUS_ZIP AS ZipCode,
CUS_SEX AS Gender, CAST(CUS_DEMCODEA AS nvarchar(20)) + ',' + CAST(CUS_DEMCODEB AS nvarchar(20))
+ ',' + CAST(CUS_DEMCODEC AS nvarchar(20)) + ',' + CAST(CUS_DEMCODED AS nvarchar(20)) AS DemoCodes,
dbo.GetSubScribedDateMLA(CUS_CUSTNUM, CUS_EMAIL) AS MLASubscribedDate, dbo.GetSubScribedDateMLP(CUS_CUSTNUM, CUS_EMAIL)
AS MLPSubscribedDate, dbo.GetSubScribedDateLDC(CUS_CUSTNUM, CUS_EMAIL) AS LDCSubscribedDate, dbo.GetMLAExpiration(CUS_CUSTNUM,
CUS_EMAIL) AS MLASubExpireDate, dbo.GetMLPExpiration(CUS_CUSTNUM, CUS_EMAIL) AS MLPSubExpireDate,
dbo.GetLDCExpiration(CUS_CUSTNUM, CUS_EMAIL) AS LDCSubExpireDate, dbo.IsProspect(CUS_CUSTNUM, CUS_EMAIL) AS AGMProspect,
dbo.IsCurrentCustomer(CUS_CUSTNUM, CUS_EMAIL) AS AGMCurrentCustomer, dbo.IsMLAMember(CUS_CUSTNUM, CUS_EMAIL) AS MLAMember,
dbo.IsMLPMember(CUS_CUSTNUM, CUS_EMAIL) AS MLPMember, dbo.IsLDCMember(CUS_CUSTNUM, CUS_EMAIL) AS LDCMember,
dbo.CalculateTotalRevenue(CUS_CUSTNUM, CUS_EMAIL) AS AGMTotalRevenue, dbo.GetPubCodes(CUS_CUSTNUM, CUS_EMAIL)
AS ProductsPurchased, dbo.GetEmailType(CUS_CUSTNUM, CUS_EMAIL, CUS_RENT_EMAIL) AS EmailType, CUS_COMPANY AS Company,
CUS_CITY AS City
FROM dbo.CUS
WHERE (CUS_EMAIL IS NOT NULL) AND (CUS_EMAIL <> '') AND (CUS_EMAIL_VALID = 'Y') AND (CUS_EMAIL LIKE '%@%.%') AND (CUS_RENT_EMAIL = 'Y' OR
CUS_RENT_EMAIL = 'R' OR
CUS_RENT_EMAIL = 'I') AND (CHARINDEX(' ', CUS_EMAIL) = 0) AND (CUS_EMAIL NOT LIKE '@%')
Thanks in advance Michael Reyeros
View 9 Replies
View Related
Apr 19, 2007
Hi folks,
After getting a form view inserting some values into a mdb file, it inserts the same values a second time on page reload.
How may I cure this? Any suggestions?
VB Code is below.
many thanks in advance
Rosi
1 <%@ Page Language="VB" MasterPageFile="~/MasterPage.master" AutoEventWireup="false" CodeFile="km_Eingabe.aspx.vb" Inherits="km_Eingabe" title="km-Eingabe" %>
2 <asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
3 <table style="width: 750px; height: 210px">
4 <tr>
5 <td style="height: 38px">
6 </td>
7 <td style="height: 38px">
8 <asp:DropDownList ID="dropdownlist1" runat="server" AutoPostBack="True" DataSourceID="AccessDataSource2"
9 DataTextField="polKennz" DataValueField="polKennz">
10 </asp:DropDownList>
11 </td>
12 <td style="height: 38px">
13 </td>
14 </tr>
15 <tr>
16 <td style="height: 235px">
17 </td>
18 <td style="height: 235px" valign="top">
19
20 <asp:FormView ID="FormView1" runat="server" CellPadding="4" DataSourceID="SqlDataSource1"
21 ForeColor="#333333">
22 <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
23 <EditRowStyle BackColor="#999999" />
24 <EditItemTemplate>
25
26 </EditItemTemplate>
27 <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
28 <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
29 <EmptyDataTemplate>
30 keine Daten vorhanden
31 <br />
32 <asp:LinkButton ID="NewButton" runat="server" CommandName="New" Text="Neuer Eintrag"></asp:LinkButton>
33 </EmptyDataTemplate>
34 <InsertItemTemplate>
35 Datum:
36 <asp:TextBox ID="DatumTextBox" runat="server" Text='<%# Bind("Datum", "{0:d}") %>'>
37 </asp:TextBox>
38 <br />
39 Fahrer:
40 <asp:TextBox ID="FahrerTextBox" runat="server" Text='<%# Bind("Fahrer") %>'>
41 </asp:TextBox>
42 <br />
43 polKennz:
44 <asp:TextBox ID="polKennzTextBox" runat="server" Text='<%# Bind("polKennz") %>'>
45 </asp:TextBox>
46 <br />
47 neuer_Eintrag:
48 <asp:TextBox ID="neuer_EintragTextBox" runat="server" Text='<%# Bind("neu") %>'></asp:TextBox>
49 <br />
50 aktuell:
51 <asp:TextBox ID="aktuellTextBox" runat="server" Text='<%# Bind("aktuell") %>'></asp:TextBox> <br />
52 <br />
53 <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
54 Text="Einfügen" OnClick="InsertButton_Click">
55 </asp:LinkButton>
56 <asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False" CommandName="Cancel"
57 Text="Abbrechen">
58 </asp:LinkButton>
59 </InsertItemTemplate>
60 <ItemTemplate>
61 Datum:
62 <asp:Label ID="DatumLabel" runat="server" Text='<%# Bind("Datum") %>'></asp:Label><br />
63 Fahrer:
64 <asp:Label ID="FahrerLabel" runat="server" Text='<%# Bind("Fahrer") %>'></asp:Label><br />
65 polKennz:
66 <asp:Label ID="polKennzLabel" runat="server" Text='<%# Bind("polKennz") %>'></asp:Label><br />
67 neu:
68 <asp:Label ID="neuLabel" runat="server" Text='<%# Bind("neu") %>'></asp:Label><br />
69 lfdNr:
70 <asp:Label ID="lfdNrLabel" runat="server" Text='<%# Eval("lfdNr") %>'></asp:Label><br />
71 aktuell:
72 <asp:Label ID="aktuellLabel" runat="server" Text='<%# Bind("aktuell") %>'></asp:Label><br />
73 Dienststelle:
74 <asp:Label ID="DienststelleLabel" runat="server" Text='<%# Bind("Dienststelle") %>'></asp:Label><br />
75 <asp:LinkButton ID="NewButton" runat="server" CommandName="New" Text="Neuer Eintrag"></asp:LinkButton>
76 </ItemTemplate>
77 <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
78 </asp:FormView>
79 </td>
80 <td style="height: 235px">
81 </td>
82 </tr>
83 <tr>
84 <td>
85 </td>
86 <td>
87 </td>
88 <td>
89 </td>
90 </tr>
91 </table>
92 <asp:AccessDataSource ID="AccessDataSource2" runat="server" DataFile="~/App_Data/KfzDaten_Ansicht.mdb"
93 SelectCommand="SELECT DISTINCT [polKennz] FROM [qry_KennzeichenAlle_ohne_ausgesondert]">
94 </asp:AccessDataSource>
95 <asp:AccessDataSource ID="AccessDataSource1" runat="server" DataFile="~/App_Data/KfzDaten_Ansicht.mdb"
96 SelectCommand="SELECT DISTINCT [Datum], [Nutzer], [Fahrer], [polKennz], [aktuell], [neu], [gefahren] FROM [qry_Fahrtenbuch_letzter_Eintrag_pro_Kfz] WHERE ([polKennz] = ?)">
97 <SelectParameters>
98 <asp:ControlParameter ControlID="DropDownList1" Name="polKennz" PropertyName="SelectedValue"
99 Type="String" />
100 </SelectParameters>
101 </asp:AccessDataSource>
102 <asp:SqlDataSource ID="SqlDataSource1" DataSourceMode="DataSet" ConflictDetection="CompareAllValues" InsertCommandType="Text" runat="server" ConnectionString="<%$ ConnectionStrings:KfzDaten_Ansicht_mdbConnectionString %>" ProviderName="<%$ ConnectionStrings:KfzDaten_Ansicht_mdbConnectionString.ProviderName %>"
103 InsertCommand= "INSERT INTO Tab_import_Fahrtenbuch([Datum], [Fahrer], [polKennz], [neu], [aktuell]) VALUES (@Datum, @Fahrer, @polKennz, @Eingabe_neu, @Eingabe_aktuell )" >
104 <SelectParameters>
105 <asp:ControlParameter ControlID="dropdownlist1" Name="newparameter" PropertyName="SelectedValue" />
106 </SelectParameters>
107 <InsertParameters>
108 <asp:FormParameter FormField="DatumTextBox" Name="Datum" Type="string" />
109 <asp:FormParameter FormField="FahrerTextBox" Name="Fahrer" Type="string" />
110 <asp:FormParameter FormField="polKennzTextBox" Name="polKennz" Type="string" />
111 <asp:FormParameter FormField="neuer_EintragTextBox" Name="neu" Type="Int32" ConvertEmptyStringToNull="false" />
112 <asp:FormParameter FormField="aktuellTextBox" Name="aktuell" Type="Int32" ConvertEmptyStringToNull="false" Direction="Input" />
113 </InsertParameters>
114 </asp:SqlDataSource>
115
116 </asp:Content>
117
118
View 5 Replies
View Related
Feb 15, 2005
Hi all,
I have two tables (staging and Cdate) and neither objects has any constraints.
staging table has ID, date, A, B, and C fields and Cdate has id,date and day fields. I need to update/insert date from Vdate into staging where staging ID=' ' and date is null
Here is the code I wrote, however, it seemed the information was updated to one date only instead of time series - Cdate contains time series in column date.
Anyone can help to fix it? Thank you for the help!
update s
set s.date=c.date
FROM cdate c join staging s on(s.id=c.id)
Where s.date is null and id=2
View 3 Replies
View Related
May 27, 2006
i have a Time Series mining model. I want to view the chart in Reporting Services.
Help me!!!!!!
View 1 Replies
View Related
Feb 28, 2005
Hello, I need some help, I am in school right now and I am in a SQL server class. We have been working in the query analizer making a database. Well I have to print out everything that I have typed. But I want to view it first. How do I do that?
Sorry I did a search and couldnt find anything.. Probably cause I dont really know what to search for or look under. Thanks for your guys time.
~Matt
View 2 Replies
View Related
Oct 4, 2015
I am studying indexes and keys. I have a table that has a fixed width of data to be loaded in the first column which is parsed in a view based on data types within the fixed width specifications.
Example column A:
(name phone house cost of house,zipcodecountystatecountry)
-a view will later split this large varchar string based
column b: is the source filename of the data load (varchar 256)
....
a. would there be a benefit of adding a clustered or nonclustered index (if so which/point in direction on why)
b. is there benefit of making one of these two columns a primary key (millions of records) or for adding a 3rd new column as a pk?
c. view: this parses the data in column a so it ends up looking more like "name phone house cost of house zipcode county state country" each having their own column.
-any pros/cons of adding indexes (if so which) to the view instead of the tables or both for once the data is parsed?
View 4 Replies
View Related