Referencing Issues
Apr 17, 2008
I am trying to run a mobile device with SQL's mobile 3.5.
When I run my application I am given an error that sqlceme35.dll plus several other references cannot be found
When I try referencing them It does not allow me too.
Is there any steps I should take to make referencing allowed?
View 1 Replies
ADVERTISEMENT
Jun 15, 2006
For example, the table below, has a foreign key (ManagerId) that points to EmployeeId (primary key) of the same table.
-------Employees table--------
EmployeeID . . . . . . . . . . int
Name . . . . . . . . . . . nvarchar(50)
ManagerID . . . . . . . . . . . int
If someone gave you an ID of a manager, and asked you to get him all employee names who directly or indirectly report to this manager.
How can that be achieved?
View 6 Replies
View Related
Nov 16, 2006
I have a SqlDataSource - The select statement
selects the DB row with an ID that equals a querystring value.... So I
know I am only selecting one row..Now I want to create a little
Sub that grabs any field(s) of my choice and then I can assign the
value of it to a textbox on my page or a variable if I need to... Any
idea how I actually reference the fields via the SQLDataSource in a
sub? I see you can reference parameters using..SqlDataSource1.SelectParameters()I was hoping I could use something similar to get the actual DB fields like the below...SqlDataSource1.Select("MyDataBaseField").Value = TextBox.TextCan anyone help please??Thanks
View 7 Replies
View Related
Mar 13, 2007
The Background:
From page 1 a search is created and this value is converted to a querystring and given the name "id=" and passed to page 2. Page 2 then does a lookup in the sql 2000 db useing this querystring.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:ListingDBConnectionString %>"
SelectCommand="SELECT [ID], [CompName], [Package] FROM [CDetails] WHERE ([ID] = @ID)">
<SelectParameters>
<asp:QueryStringParameter Name="ID" QueryStringField="id" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
The Problem:
What I then need to do is an IF THEN ELSE statement.
IF [Package in SQL1] = 4 Then
Package 4
IF [Package in SQL1] = 3 Then
Package 3
Only how do I reference the sql value in the if statement.
I have tried
<%IF Eval("Package") = 4 Then %> and with Bind - No good
View 4 Replies
View Related
May 4, 2008
Hi all, How do I return pictures along with my search results? For example, I have a shoe database and for the results I would like one column to hold a picture of the shoe (the other columns hold Brand, Name, Price, etc) The way I am looking at implementing this is by referencing the image and retrieving it from the server. I'm a bit lost on how to do this though. Any help? Thanks in advance,Nick
View 4 Replies
View Related
Sep 1, 2007
Hi,
I'm using MS SQL 2005 Express.
CREATE TABLE Folder (
iD int NOT NULL IDENTITY (1, 1) PRIMARY KEY,
folderName varchar(50) NOT NULL,
parentFolderID int NULL
FOREIGN KEY REFERENCES Folder (iD)
)
GO
if I add an ON DELETE CASCADE to the foreign key, then i get an error... which is annoying. If a folder is deleted, then all its sub-folders should also be automatically deleted.
The error is: 'Introducing FOREIGN KEY constraint 'FK__Folder__parentFo__7D78A4E7' on table 'Folder' may cause cycles or multiple cascade paths. Specify ON DELETE NO ACTION or ON UPDATE NO ACTION, or modify other FOREIGN KEY constraints.'
Anyone got any advice?
View 1 Replies
View Related
Jul 20, 2005
I was created a function named aa.It is possible to reference to it without using the dbo. prnounce ?eg: select aa(), not select dbo.aa()thanks,Viktor
View 1 Replies
View Related
Nov 16, 2007
Hello,
I need to sum up a sub-report value, but I don't know the syntax to reference the subreport.
How do I reference a subreports value to sum it up?
Thanks,
View 7 Replies
View Related
Nov 28, 2007
I'm setting up a trigger that will fire off an email explaining that this entry has been updated, however I need a reference to the updated row so I only send that bit of information off.
Heres my code thus far:
ALTER TRIGGER [dbo].[completeCreation2]
ON [Database_Test].[dbo].[Projects]
AFTER UPDATE
AS
-- SEND EMAIL
EXEC msdb.dbo.sp_send_dbmail
@profile_name = 'Administration',
@recipients = 'email@email.com',
@body = 'A new project has been created view details of the project below:',
@subject = 'Project Created',
@body_format = 'TEXT',
@importance = 'High',
@query = 'Select * FROM updated';
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
END
I thought the select From updated would work but it doesn't I need a reference for that line, select * FROM _____.
Thanks
View 3 Replies
View Related
Nov 20, 2007
Hi
This is probably a noob question. In reference to my previous post about OLE DB and variables, I need to copy the whole result set to a table. i tried
Code Block
exec('insert into '+@tableName+' ('+@ColumnNames+') '+@curTableResult)
where @tableName is the table name, @ColumnNames are the column names and @curTableResult is the Result set produced by the Execute SQL statement before. Obviously didnt work.
How do I copy the Result set to a table?
Thanks
CoyoteM
View 7 Replies
View Related
Nov 8, 2007
Hi there everyone,
A quick question. How do I reference variables (system and user) in SSIS by name instead of by just using a "?". The reason why I'm asking is because I'm trying to log what happens in a package to SQL, and if I cannot reference a variable by name it tries to insert variable values into incorrect fields?
An example of the code I'm trying to use can be found below:
Code Block
UPDATE dbo.History_Control_Table
SET
End_Date = GetDate()
, Result = 'Success'
, Status = NULL
, No_Of_Records_Processed = ? --This is where I want to tell it which variable to use
, Package_Name = ?
, No_Of_Records_Rejected = ?
--etc etc etc
WHERE
Package_Name = ?
AND Task_Name = 'Deals_Fact_Stg'
AND Status = 'Running'
Thanks in advance.
Chow.
View 11 Replies
View Related
Sep 18, 2006
This book 'MS SQL Server 2000 Bible' says the following:
'The foreign key can reference primary keys, unique constraints, or unique indexes of any table'
I've never heard of this before, I thought that the FK always established referential integrity by referencing the PK in the parent table. Does anyone have a further explanation of this?
thx,
Kat
View 5 Replies
View Related
Feb 7, 2008
Is there a way to reference textboxes in an SSRS table like one would for cells in Excel? For example, something like =textbox1/textbox2? I am trying to replace a spreadsheet by turning it into an automated report and need to do some horizontal formulas and when I put in the grouped total, it always defaults to averaging percetages from the rows above, which isnt a true summary in my case.
View 11 Replies
View Related
May 25, 2005
I have a table that holds a ParentID and the RecordID. There is a column called IsEnabled which is a bit field indicating if a folder can be displayed or not. 0 = NO, 1 = YESThe table is for a directory structure which is virtual and displays folders on a web page.Root----- 1---------- 1-1---------- 1- 2----------------- 1-2-1----------------- 1-2-2----------------------- 1-2-2-1----------------- 1-2-3----------------- 1-2-4---------- 1- 3---------- 1- 4I need a query that will not select any children that are under a Parent that is disabled. So if ' 1- 2 ' is disabled then:---------- 1- 2----------------- 1-2-1----------------- 1-2-2----------------------- 1-2-2-1----------------- 1-2-3----------------- 1-2-4SHOULD NOT SHOW.Can anyone give me a query that will overcome this problem i have.-J
View 4 Replies
View Related
Jul 24, 2002
Anyone know a way to pull specific fields from an excel spreadsheet.
I'm using SQL7 DTS to pull data into a SQL table. I can pull the entire
sheet but I just want certain fields.
thanks, archie
View 2 Replies
View Related
Jul 18, 2000
I would like a stored proc to be fed the table name as a paramater.
I tried below
create procedure testit as
set nocount on
declare @tblnm varchar(50)
select * from @tblnm
but it get Server: Msg 170, Level 15, State 1, Procedure testit, Line 5
Line 5: Incorrect syntax near '@tblnm'.
Any idea
View 1 Replies
View Related
Sep 30, 2006
I'm quite new to using t-sql, so hopefully the answer to this should be fairly simple... I have the following basic stored procedure:
Quote: CREATE PROCEDURE dbo.SP_Check_Login (
@arg_UserEmail VARCHAR(255),
@arg_UserPassword VARCHAR(255))
AS
BEGIN
SELECT a.userArchived,a.userPasswordDate
FROM app_users a
WHERE a.userEmail = @arg_UserEmail
AND a.userPassword = @arg_UserPassword
END;
GO
What I want to do is some conditional statements on the query results.
i.e:
IF (userArchived = 1)
RETURN "Archived"
ELSE IF (userPasswordDate < dateadd(month,-3,getdate())
RETURN "UpdatePassword"
ELSE
RETURN "OK"
So firstly how to I reference the data returned by the query, and secondly am I on the right track with the conditional code?
Thanks, Mike
View 2 Replies
View Related
Oct 17, 2005
Hello,
I have an access database and an SQL database and using data transformation services, i want to update the access database using the SQL data.
Can anyone tell me the syntax for referencing the access database?
Is it something like: [TABLENAME].dbo.FIELDNAME ?
Just to clarify, i have
Microsoft Access Database
Table 1 (UnitHistory)
SQL Database
Table 1 (UnitHistory)
How do i reference these seperately? I want to update the microsoft access database based on the SQL database data.
Eventually i'm trying to update an access database using the data held on my SQL server. Is DTS the best way for me to acomplish this or should i use another method?
Thanks guys
View 1 Replies
View Related
May 8, 2008
Hi there
Let say i have single dataset with different view (tables/list/matrix etc) with filter on it. Is it possible referencing from one view (table/list/matrix) to another? Basically how to access the other field for instance SUM from different view and used for the other view instead.
Thank you
View 1 Replies
View Related
May 16, 2008
I have a UniqueIdentifier as a self referencing foreign key. The pk gets set by default using the newid(). I need the foreign key to default to that same value. how can i do that? @@identity doesnt work, $rowguid doesnt work, column name doesnt work. Any ideas?
View 9 Replies
View Related
Jun 17, 2008
Hi there,
I'm trying to calculate a sort of rating:
select Player,
sum(case when Event = 'S' then 1.0 else 0.0 end) as Success,
sum(case when Event in ('S', 'F') then 1.0 else 0.0 end) as Attempts,
case when Attempts > 0 then Success / Attempts else NULL end as Rating
from EventList
group by Player
It says comlumn names are invalid. Any idea?
Thanks,
Bjoern
The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION.
View 4 Replies
View Related
Feb 27, 2008
Excuse me if my terminlogy is inaccurate, i'm a .NETer that's new to SQL.
I was wondering if it's possible to reference a column in the WHERE CLAUSE that has been customily defined in the SELECT statement
for example
select employeeID, case when JobCode = 'A' then 'Accountant'
case when JobCode = 'C' then 'Consultant'
case when JobCode = 'B' then 'Biller'
End as JobType
from Employee
where JobType is not null
This does not work, and saids JobType is an invalid column name. Basically, what I want is to display the jobtype of the employee but i also want to only display the employees that are Accountants, consultants and billers.
Is this possible and what would be the best way of doing this?
I do not seem to be about to reference JobType in the WHERE statement.
View 10 Replies
View Related
Oct 23, 2007
Is there a way to refer to "current report item" using something like "this" or "me"? For example: I find myself often cutting and copying code to change the format or color of text boxes based on their value thoughout a report, and it seems like it'd be more efficient to write the formatting code once and then call it from each text box.
View 1 Replies
View Related
Mar 2, 2007
help how to reference n rename table..
is it possible by code?
View 7 Replies
View Related
Feb 27, 2008
Excuse me if my terminlogy is inaccurate, i'm a .NETer that's new to SQL.
I was wondering if it's possible to reference a column in the WHERE CLAUSE that has been customily defined in the SELECT statement
for example
select employeeID, case when JobCode = 'A' then 'Accountant'
case when JobCode = 'C' then 'Consultant'
case when JobCode = 'B' then 'Biller'
End as JobType
from Employee
where JobType is not null
This does not work, and saids JobType is an invalid column name. Basically, what I want is to display the jobtype of the employee but i also want to only display the employees that are Accountants, consultants and billers.
Is this possible and what would be the best way of doing this?
I do not seem to be about to reference JobType in the WHERE statement.
View 1 Replies
View Related
Feb 8, 2007
Is there a way to reference a value from a textbox in a matrix? In other words I want to pull the value in the textbox that is the column header into a cell in the matrix under certain conditions.
View 3 Replies
View Related
Jun 1, 2007
I have the following data set - there is more to it than whats below, I just made it easier to read and highlight my problem!
SELECT LEFT(actv.ProjID, 4) AS proj, actv.Activity, actv.TotalExpensesLB, actv.PADM
FROM dbo.xtbl_MERActv actv
WHERE LEFT(actv.projID,4) = @project OR actv.PADM = @PADM
What I want to do is have the user enter a 4 digit number (@project) which will correspond to LEFT(actv.ProjID, 4). The way it is now, if the user enters a 4 digit number, no records are returned. If the user enters a 6 digit number ( the real length of the projID), then it runs correctly and I get the records I want.
I have tried to use the alias 'proj' in the where statement, but I get an error message that it is an invalid column name.
Where am I going wrong?
Thanks in advance!
View 6 Replies
View Related
Jul 22, 2015
I have a very simple bit of code.
SELECT dbo.MF_PATIENT.Forename,
dbo.MF_PATIENT.Surname,
dbo.MF_PATIENT.DOB,
dbo.MF_PATIENT.Postcode,
Count(dbo.MF_PATIENT.HEYNo) AS CountOfHEYNo
[Code] ....
My issue is I want to run this bit of code but only if dbo_MF_PATIENT.MFPatientID appears in any of the 3 tables below:
dbo_ED_ATTENDANCE, dbo_OP_APPOINTMENT, dbo_IP_ADMISSION
Suppose im unsure on the joining because there is only ever one patient in the
dbo_MF_PATIENT table but they could appear dozens of times in any of the other 3 tables.
View 18 Replies
View Related
May 8, 2008
Hi there
Let say i have single dataset with many view (tables/list/matrix etc) and utilise "filter" to manipulate each view.
Is it possible referencing from one view (table/list/matrix) to another? Basically how to access the other field for instance SUM from different view and used for the other view instead. People mentioned about SCOPE but I don't think this is relevant to this situation ?!?!
Thank you
View 1 Replies
View Related
Jul 24, 2006
Is there a way you can reference a prebuilt CLR function in a custom dataflow task?
The CLR and the custom dataflow task are one in the same. The reason that I'm designing the custom task is that I find that it's time consuming to make a call to the database to retrieve a function to work on something that's already in memory. Also, another reason is that if the code needs to be updated, it doesn't have to be done in 2 places allowing for less confusion.
I tried adding a reference to the CLR function in my SSIS dataflow task, but when I try running it in SSIS, I get the error saying it cannot use a SQL CLR defined task in the package which I believe is due to this reference in the CLR code:
[Microsoft.SqlServer.Server.SqlFunction]
public static string toCase(string text, string caseType)
Is there a way to circumvent the [...SqlFunction] line of code when the DLL is referenced by an SSIS dataflow task, or do I just have to deal with having 2 copies of the same code?
Thanks in advance!
View 1 Replies
View Related
Jul 31, 2006
Please see following code :
SqlConnection conn=new SqlConnection(@"something....;");SqlCommand comm=new SqlCommand("Select TOP 10 * FROM TableReaderTest WITH (HOLDLOCK) ",conn);
conn.Open();SqlDataReader rd;conn=null;
try{ rd = comm.ExecuteReader(); rd.Close();}catch (Exception ex){ MessageBox.Show(ex.Message);}
This Code works fine. I have set conn=null, still datareader is able to read the data. Why?
Thank you.
View 6 Replies
View Related
Apr 3, 2008
In C#, when I'm using an SqlDataReader to run a simple select query and use the values returned I have a question about referencing the field values.
There seem to be a large number of "Get" type methods (i.e reader.GetValue(int i), etc.) All of them (that I have found so far, require the use of the index of the field (GetValue(0) is the first field and so on).
Is there a way to use the actual name of the field? (i.e. GetValue("myField"))? This helps code readability but the big reason is that changes to the underlying field list can completely hose up the application.
I know there are such functions in VB, but I just can't seem to find the equivelants in C#.
View 4 Replies
View Related
Aug 31, 2000
I receive the following error when creating a CHECK constraint that references another column. According to the good old Wrox SQL Server book, I'm using the correct syntax. Anyone have any ideas???
Thanks in advance!
Server: Msg 8141, Level 16, State 1, Line 1
Column CHECK constraint for column 'end_date' references another column, table 'Session'.
Here's an example of the script that I'm using:
CREATE TABLE Session (
session_key char(18) NOT NULL,
course_key char(18) NOT NULL,
site_key char(18) NOT NULL,
instructor_key char(18) NOT NULL,
start_date smalldatetime NULL,
end_date smalldatetime NULL
CHECK (end_date >= start_date)
)
.
View 1 Replies
View Related