Im New To Using Views, And This Program They Have Me Working On Is Using Them Quite Heavily..(cant Read From A View)

Oct 11, 2007

This is my first post, so if i have not posted things in the best manner please lemme know how to be more informative,clear, so that i can learn.

So i have made a view with the following command



GO

/****** Object: View [dbo].[AppraisalView_C] Script Date: 10/11/2007 12:10:43 ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

ALTER VIEW [dbo].[AppraisalView_C]

AS

SELECT a.Counter

,a.DateCreated

,a.DateModified

,a.UserCreated

,a.UserModified

,a.AppraisalDate_C

,a.TypeID_C

,a.Customer_C

,a.Employee_C

,b.Notes_C

,b.Value_C

,b.AppraisalLineItemID_C

,b.AppraisalID_C

FROM dbo.Appraisal_C AS a

INNER JOIN dbo.AppraisalLineItem_C AS b ON a.AppraisalID_C = b.AppraisalID_C



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

the program im working on creates the SQL call to read from this view and creates
the following query


SELECT A.[AppraisalDate_C], A.[AppraisalID_C], A.[AppraisalLineItemID_C], A.[Customer_C], A.[Employee_C], A.[Notes_C], A.[TypeID_C], A.[Value_C]

FROM AppraisalView_C A

WHERE [AppraisalView_C].[AppraisalID_C] = 'APP-000006'


but I end up getting the dreaded "Msg 4104, Level 16, State 1, Line 1 The multi-part identifier "AppraisalView_C.AppraisalID_C" could not be bound." error....

I cant change the Query that is called, but i can change the view, what is wrong?

View 4 Replies


ADVERTISEMENT

How To Modify A Views' SQL Source From A Program

Jul 20, 2005

Hi all, Thanks in advance to any contributions to my question.Im running SQLServer 2000 in a Win 2000 Server env.Background:==========The database has many views that range from simple to complex joins ontables.The selection criteria is fixed eg. 'Where TaskTypeIdent = 2204 andOutcomeId = 123 or 2322 or 1222 andCicType = 87878 ... etc etcRequirement:===========Now what I would like to do is be able to change the 'where =' valuepart ie. 2204, dynamically if and when required, and it will berequired.In other words there won't be a DBA handy to do this when it changeshence I would like to write a front end UI to allow the user to easilymanage this.There are upwards of 200 views like this.Question:========Where in the system metadata can I access (if possible) the source ofthe View such that I can update it with the new values. eg. 'WhereTaskTypeIdent = 7627 and OutcomeId = 2322 or 94847 or 989 and CicType =1111 ... etc etcMany thanksPaul*** Sent via Developersdex http://www.developersdex.com ***Don't just participate in USENET...get rewarded for it!

View 5 Replies View Related

Can I Read What Is In A SSIS Variable From Within A C# Program That Executed It?

May 21, 2007

Can I read what is in a SSIS variable from within a C# program that executed it?

View 3 Replies View Related

Paged Query Not Working Via Program

Mar 27, 2008

I am trying to move my application (asp.net) from a non-paged
select to a paged query.

I am having a problem. Below is my Stored Procedure. The
first Query in the procedure works...the rest (which are commented
out ALL work interactively, but fail when the program tries to
access....The ONLY THING I change is the stored procedure
I switch the comment lines to the non-paged procedure and it
works, I try to use the any of the paged procedures and it
fails with the same error (included below)

I can't see where any of the queries are returning
different results. I have also included the program abort
that happens, it is the same for all of the paged queries.

ALTER PROCEDURE dbo.puse_equipment_GetAllTypedEquipment
(
@EquipmentTypeId int,
@StartRowIndex int,
@MaximumRows int
)
AS


-- ************************************************************************************************
-- Non-Paged OUTPUT
-- THIS WORKS!!!!!
SET NOCOUNT ON
SELECT Equipment.*,
EquipmentType.Name as EquipmentType,
EquipmentCategory.Name as Category
FROM Equipment INNER JOIN EquipmentCategory ON EquipmentCategory.CategoryId = Equipment.CategoryId
INNER JOIN EquipmentType ON EquipmentType.EquipmentTypeId = Equipment.EquipmentTypeId
where Equipment.EquipmentTypeId = @EquipmentTypeId AND
Equipment.IsDeleted = 0


/*
-- ************************************************************************************************
-- Using a Temp Table
--THIS WORKS INTERACTIVELY, But NOT When Called by the program
SET NOCOUNT ON
create table #PagedEquipment
(
IndexId int IDENTITY(1,1) Not NULL,
EquipId int
)

-- Insert the rows from Equipment into the PagedEquipment table
Insert INTO #PagedEquipment (EquipId)
select EquipmentId From Equipment
WHERE IsDeleted = 0


SELECT #PagedEquipment.IndexId, *,EquipmentType.Name as EquipmentType, EquipmentCategory.Name as Category
FROM Equipment
INNER JOIN #PagedEquipment with (nolock) on Equipment.EquipmentId = #PagedEquipment.EquipId
INNER JOIN EquipmentCategory ON EquipmentCategory.CategoryId = Equipment.CategoryId
INNER JOIN EquipmentType ON EquipmentType.EquipmentTypeId = Equipment.EquipmentTypeId
Where #PagedEquipment.IndexId Between (@StartRowIndex) AND (@StartRowIndex + @MaximumRows +1)
*/


/*
-- **********************************************************************************************
--Using the With to create a temp table (in memory)..works interactively but fails when
--called by the application..
--THIS WORKS INTERACTIVELY, But NOT When Called by the program
Set NOCOUNT ON;
With PagedEquipment AS
(
SELECT EquipmentId,
ROW_NUMBER() OVER (Order by Equipment.EquipmentId) AS RowNumber
FROM Equipment
WHERE EquipmentTypeId = @EquipmentTypeId AND
IsDeleted = 0
)

SELECT RowNumber, Equipment.*, EquipmentCategory.Name as Category, EquipmentType.Name as EquipmentType
FROM PagedEquipment
INNER JOIN Equipment ON Equipment.EquipmentId = PagedEquipment.EquipmentId
INNER JOIN EquipmentCategory ON Equipment.CategoryId = EquipmentCategory.CategoryId
INNER JOIN EquipmentType ON Equipment.EquipmentTypeId = EquipmentType.EquipmentTypeId
WHERE PagedEquipment.RowNumber Between (@StartRowIndex+1) AND (@StartRowIndex+1+@MaximumRows)
return
-- *******************************************************************************************
*/

/*
-- ********************************************************************************************
--nested selects
--THIS WORKS INTERACTIVELY, BUT NOT WHEN CALLED FROM THE PROGRAM
SET NOCOUNT ON
Select * From
(
Select Row_Number() OVER (Order By Equipment.EquipmentId) as RowNumber,
Equipment.*,
EquipmentType.Name as EquipmentType,
EquipmentCategory.Name as Category
FROM Equipment INNER JOIN EquipmentCategory ON EquipmentCategory.CategoryId = Equipment.CategoryId
INNER JOIN EquipmentType ON EquipmentType.EquipmentTypeId = Equipment.EquipmentTypeId
where Equipment.EquipmentTypeId = @EquipmentTypeId AND
Equipment.IsDeleted = 0
) equip
Where equip.RowNumber between (@StartRowIndex+1) AND (@StartRowIndex + 1 + @MaximumRows )
-- ************************************************************************************************
*/

Server Error in '/pUse' Application.
--------------------------------------------------------------------------------

Arithmetic overflow error converting expression to data type int.
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: Arithmetic overflow error converting expression to data type int.

Source Error:


Line 148: {
Line 149: List<EquipmentDetails> equipment = new List<EquipmentDetails>();
Line 150: while (reader.Read())
Line 151: equipment.Add(GetEquipmentFromReader(reader));
Line 152: return equipment;


Source File: c:Documents and SettingsBrianDesktoppuseApp_CodeDALEquipmentEquipmentProvider.cs Line: 150

Stack Trace:


[SqlException (0x80131904): Arithmetic overflow error converting expression to data type int.]
System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection) +925466
System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +800118
System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj) +186
System.Data.SqlClient.TdsParser.Run(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1932
System.Data.SqlClient.SqlDataReader.HasMoreRows() +150
System.Data.SqlClient.SqlDataReader.ReadInternal(Boolean setTimeout) +212
System.Data.SqlClient.SqlDataReader.Read() +9
PredominantUse.DAL.Equipment.EquipmentProvider.GetEquipmentCollectionFromReader(IDataReader reader) in c:Documents and SettingsBrianDesktoppuseApp_CodeDALEquipmentEquipmentProvider.cs:150
PredominantUse.DAL.Equipment.SqlClient.SqlEquipmentProvider.GetTypedEquipmentList(Int32 EquipmentTypeId, Int32 StartRowIndex, Int32 MaximumRows) in c:Documents and SettingsBrianDesktoppuseApp_CodeDALEquipmentSqlClientSqlEquipmentProvider.cs:103
PredominantUse.BLL.Equipment.GetTypedEquipment(Int32 EquipmentTypeId, Int32 StartRowIndex, Int32 MaximumRows) in c:Documents and SettingsBrianDesktoppuseApp_CodeBLLEquipmentEquipment.cs:259
PredominantUse.BLL.Equipment.GetTypedEquipment(Int32 EquipmentTypeId) in c:Documents and SettingsBrianDesktoppuseApp_CodeBLLEquipmentEquipment.cs:238

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +0
System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner) +72
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks) +371
System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture) +29
System.Web.UI.WebControls.ObjectDataSourceView.InvokeMethod(ObjectDataSourceMethod method, Boolean disposeInstance, Object& instance) +480
System.Web.UI.WebControls.ObjectDataSourceView.ExecuteSelect(DataSourceSelectArguments arguments) +1960
System.Web.UI.DataSourceView.Select(DataSourceSelectArguments arguments, DataSourceViewSelectCallback callback) +17
System.Web.UI.WebControls.DataBoundControl.PerformSelect() +149
System.Web.UI.WebControls.BaseDataBoundControl.DataBind() +70
System.Web.UI.WebControls.GridView.DataBind() +4
System.Web.UI.WebControls.BaseDataBoundControl.EnsureDataBound() +82
System.Web.UI.WebControls.CompositeDataBoundControl.CreateChildControls() +69
System.Web.UI.Adapters.ControlAdapter.CreateChildControls() +12
System.Web.UI.Control.EnsureChildControls() +128
System.Web.UI.Control.PreRenderRecursiveInternal() +50
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Control.PreRenderRecursiveInternal() +170
System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +2041




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:2.0.50727.1433; ASP.NET Version:2.0.50727.1433

View 1 Replies View Related

Working With Views

Mar 6, 2001

Does anyone know how effective views work?

I have data in three tables I want to merge, my main condition is I want it to run very fast becasue there will be about 300,000 records.

Should I use a view to merger the information? Or is there a better way

Thanks.

Sola

View 1 Replies View Related

JDBC Connection With IntegratedSecurity Not Working On Views?

Jun 25, 2007

Hello,
I've been developing a web application with a Java backend that connects to a SQL Server database with the JDBC driver 1.1 for a while now. Until now, everything was working fine. Now I had to add Windows authentication to the application.
After reading through the JDBC online help, I added the property
integratedSecurity=true to the connection string and copied the sqljdbc_auth.dll to the windowssystem32 directory of the system with the backend.
Logging in works fine, but the problem is that SQL statements that work on views throw SQLServerException errors, the message is
Invalid object name '(name of the view)'

It doesn't matter if a user is configured to log in via windows authentication or via SQL server authentication.
I need to access those views instead of the real tables because this is part of my security concept, the database creates views for each user based on his role.

Is this a known problem with the JDBC driver or a configuration issue?

Thanks for the help.

View 3 Replies View Related

SQL Server 2008 :: Partitioned Views Table Elimination Not Working

Jul 7, 2015

I have some Partitioned Views and on all queries using a table for the in clause, table elimination isn't happening.

Check Constraint is on the oid column

This works as expected, only goes to 2 tables;
SELECT *
FROM view_oap_all
WHERE oid IN ( '05231416529481', '06201479586431' )

This works as expected, only goes to 2 tables;
SELECT *
FROM view_oap_all
WHERE oid IN ( SELECT oid
FROM owners
WHERE oid IN ( '05231416529481', '06201479586431' ) )

This is checking all tables (headingnames are unique), ive tried this for the last 3 hours on many different tables containing the oid column.

Unless I write the oid as in the above queries it just doesn't work.
SELECT *
FROM view_oap_all
WHERE oid IN ( SELECT oid
FROM owners
WHERE headingname = 'TestSystem' )

View 6 Replies View Related

Permissions To View INFORMATION_SCHEAM Views

Aug 9, 2002

SQL7, sp3

What specific permissions do you need to be able to view information_schema views? I thought public role had permissions to select on these views, but this is not the case? What do I do?

my developers have db_reader, db_writer, and db_ddladmin. They do not have db_owner. If I make them Sysadmin in sql they can view them, but that doens't fit in our security setup we have. THoughts?

Thanks,

View 2 Replies View Related

View That Unions Two Other Views Does Not Work

May 1, 2006

I created a view V1 that uses an outer join with a table and calls a sub-view VS1 (ds_proj_report_date) which uses an inner join) and does an inner join with VS1. I also created another view V2 that uses inner join but does not call the sub-view VS1.

When I run the two views as below it works fine

Select * from V1
Union
Select * from V2


I then created another view V3 of the above union as

Create view V3
As
Select * from V1
Union
Select * from V2

Now when I run select * from V3, I get the following error.
Joined tables cannot be specified in a query containing outer join operators. View or function 'ds_proj_report_date' contains joined tables

View 1 Replies View Related

View That Would Output Data From Two Views

Aug 8, 2007

OK,

I have two data tables where depending on the time line item it is, it needs a different join.

So, it's like this:

Table Credit Card
Table Memo

If Credit Card is VISA, join on column A
If Credit Card is MA, join on column B

So, I created two views. One view has all the info joined on column A. The other view has all the info joined on column B.

How do I create a third view that will output all the data from View A and View B without making it into a cartesian product?

I can't change the table structure due to legacy application/data issues.

Thanks!

View 3 Replies View Related

View With Read Only Option ?

Oct 12, 2004

Hi,

Is there anyway to create view with read only option as in Oracle ? (OR) is there any
workaround for the same ?

Please advice,

Thanks,
Sam

View 3 Replies View Related

Do Sqlexception Breaks The Functionality Of The Program? (program Flow)

May 23, 2007

why we use sql exceptions ...

what the program will do if we caught that exception .. i need some suggestions ... i got this exception(String or binary data would be truncated.
The statement has been terminated.).. will it affect the functionality of the program...

hiow can i avoid this exception..

View 1 Replies View Related

Sql Views - Embedded View Work-a-rounds

Jul 11, 2007

hi guys,

i've been asked to re-write a sql view. the view itself contains several calls to other views (embedded). is there a way to get around using embedded views. I've written the same query up using temp. tables but obviously temp. tables can't be used in views?

Is there any special things I should be looking for?

View 2 Replies View Related

Does A View Refresh Itself When I Reference It? (was Question On Views)

Feb 24, 2006

guys, ive never worked with Views before so forgive me.
i know how to create one, and that it creates a virtual table in memory, but i've got one small question.

if i create a view:

CREATE view dbo.myView
as
select Distinct FirstName,LastName from SomeTable


When ever i reference that view, such as
Select FirstName,LastName
from myView
where LastName like 'Jo%'

does that View Refresh itself??

in other words does it run each time i Reference it??? or is it static from when i created it.

Wouldnt it be easier just to use a #TempTable or some other Table thats used to hold a few values?

thanks for any help
rik

View 3 Replies View Related

CREATE VIEW, Seperate One Column In Two Views..

Oct 17, 2007

I am creating a view for the table:
bellus=# select * from host_application_definition;
id | type_value | connection_value | group_value | application_value | host
----+------------+------------------+-------------+-------------------+----


From the table meta_host_types;

id | value | types | name
----+-------+-----------+--------
1 | agm | host-type | Rencid

I would like to seperate value into type_value and connection_value, because it holds both values.

Any tip?

bellus=# d host_application_definition;
Table "public.host_application_definition"
Column | Type | Modifiers
-------------------+---------+--------------------------------------------------------------------------
id | integer | not null default nextval('host_application_definition_id_seq'::regclass)
type_value | integer |
connection_value | integer |
group_value | integer |
application_value | integer |
host | integer |
Indexes:
"host_application_definition_pkey" PRIMARY KEY, btree (id)
Foreign-key constraints:
"host_application_definition_application_value_fkey" FOREIGN KEY (application_value) REFERENCES appsmarteye(id)
"host_application_definition_connection_value_fkey" FOREIGN KEY (connection_value) REFERENCES meta_host_types(id)
"host_application_definition_group_value_fkey" FOREIGN KEY (group_value) REFERENCES meta_host_grouptypes(id)
"host_application_definition_host_fkey" FOREIGN KEY (host) REFERENCES master_hosts(id)
"host_application_definition_type_value_fkey" FOREIGN KEY (type_value) REFERENCES meta_host_types(id)



d meta_host_types;
Table "public.meta_host_types"
Column | Type | Modifiers
-------------+---------+---------------------------------------------------------------------
id | integer | not null default nextval('meta_types_application_id_seq'::regclass)
application | integer |
value | text |
comments | text |
types | text |
Indexes:
"meta_types_application_pkey" PRIMARY KEY, btree (id)
"meta_host_types_id_key" UNIQUE, btree (id)
"meta_host_types_value_key" UNIQUE, btree (value, application)
"meta_host_types_value_key1" UNIQUE, btree (value)
Foreign-key constraints:
"meta_types_application_application_fkey" FOREIGN KEY (application) REFERENCES appsmarteye(id)

View 3 Replies View Related

SQL Views - Embedded View Work-a-rounds

Jul 12, 2007

Hi guys,I've been asked to re-write a sql view. The view itself containsseveral calls to other views (embedded). Is there a way to get aroundusing embedded views. I've written the same query up using temp.tables but obviously temp. tables can't be used in views?Is there any special things I should be looking for?

View 2 Replies View Related

Transact SQL :: Combine Two Views Into One Statement Or One View

Oct 15, 2015

I'd like to get results from ZTest_Contract being my result set, and would like to combine the subquery (which gets the Max) into the primary view ZTest_Contract.

CREATE VIEW [dbo].[ZTest_Contract] AS
Select
M.CUSTNMBR,
M.ADRSCode,
M.Contract_number,
M.MaxWSCONTSQ,
M.Equipment_id,

[Code] ......

View 3 Replies View Related

Creating A Single View From 2 Existing Views

Aug 9, 2007

I have 2 views which contain the following fields:
EVENT,
WEEK,
SUBSCRIPTION,
QTY,
GROSS_AMOUNT,
SEASON

The 2 views differ by SEASON. I'm attempting to combine the 2 views in to a single view or table grouping by EVENT, WEEK and SUBSCRIPTION:

EVENT,
WEEK,
SUBSCRIPTION,
Q6 (qty of season 1),
A6 (gross_amount of season 1),
Q7 (qty of season 2),
A7 (gross_amount of season 2)


Below is my select command:

------

SELECT TOP 100 PERCENT
dbo.vw_SEASON06.EVENT,
SUM(dbo.vw_SEASON06.QTY) AS Q6, SUM(dbo.vw_SEASON06.GROSS_AMOUNT) AS A6,
SUM(dbo.vw_SEASON07.QTY) AS Q7, SUM(dbo.vw_SEASON07.GROSS_AMOUNT) AS A7,
dbo.vw_SEASON06.WEEK,
dbo.vw_SEASON06.SUBSCRIPTION

FROM dbo.vw_SEASON06 FULL OUTER JOIN
dbo.vw_SEASON07 ON dbo.vw_SEASON06.WEEK = dbo.vw_SEASON07.WEEK AND
dbo.vw_SEASON06.SUBSCRIPTION= dbo.vw_SEASON07.SUBSCRIPTION AND
dbo.vw_SEASON06.EVENT = dbo.vw_SEASON07.EVENT

GROUP BY
dbo.vw_SEASON06.EVENT,
dbo.vw_SEASON06.WEEK,
dbo.vw_SEASON06.SUBSCRIPTION

ORDER BY
dbo.vw_SEASON06.EVENT

-----

This creates the view but there are some issues. If an 'EVENT' exists in dbo.vw_SEASON07.EVENT and doesn't exist in dbo.vw_SEASON06.EVENT the value of the field 'EVENT' is set to NULL because the 'EVENT' name is returned from dbo.vw_SEASON06.EVENT. The same issue exists for 'SUBSCRIPTIONS' and 'WEEK'.

How can I create a single view/table that will include all the data from these 2 views without the NULL values in EVENT or SUBSCRIPTION?

Any help is appreciated!

View 7 Replies View Related

Read Only Cells In A Simple View

Feb 12, 2007

Mikel Arzak writes "Hi,

I have a DB migrated from SQL Server 2000 to SQL Server 2005 and I
have a strange problem that I don't find any reason.

I make a simple SQL Query with one table showing all the fields and
everything goes well. But when I insert another auxiliar table and
showing one field, then I can't change any field of the main table.
SQL Server shows me the message Read Only Cell. Why this happens? This problem didn't happen in SQL Server 2000.

The select sentence that works:

SELECT Notas_Estructura.* FROM Notas_Estructura

The previous Select sentence modified that doesn't work:

SELECT Notas_Estructura.*, Alumnos.Apellido1, Alumnos.Apellido2,
Alumnos.Nombre FROM Notas_Estructura INNER JOIN Alumnos ON Notas_Estructura.CodAlumno = Alumnos.CodAlumno

Thanks for your help."

View 1 Replies View Related

How To Read Select Statement From A View?

Oct 18, 2007

Hello,

I want to write a t-sql script, that reads the select statement from
an existing view.

How can I get access to the select-statement in the view definition?

Help!

Thanks a lot.

Best Regards

Gerhard

View 3 Replies View Related

User Permissions - Read Only With Create View

Jan 11, 2008

I need to create a new login with SELECT rights so the users can view all tables with no UPDATE, DELETE, OR INSERT rights. But this user needs to be able to CREATE VIEWS. I have assigned the user to the Public role and gone in and modified Securables for the Database to be able to CREATE VIEW. When I connect using my new user and try to create a view, I get the error message: CREATE VIEW permissions denied in database 'test01'.

Help Please

TMDavis

View 1 Replies View Related

Heavily Indexed Databases

Mar 7, 2005

Hi all,
i have a very general question about databases. What is the advantage and disadvantage of using a heavily indexed database?

The advantage i could think is that search operations will be fast. The disadvantage (according to me who is a newbie) is that the size of the database will increase.

My teacher however is not very happy with this answer and wants me to research more. Any help will be greatly appreciated.

Thanks

View 1 Replies View Related

Heavily Accessed DBs On Server?

Jun 2, 2008

What are my options to find heavily accessed DBs on a server? I know I can do this by profiler and some counters. Is there any tool which gives me this information easily?


------------------------
I think, therefore I am - Rene Descartes

View 10 Replies View Related

View Of All User Objects (Tables, Views) With Their Replication State NEEDED...

Jun 22, 2007

Hi!



There is a view in our replicated SQL-2000 database, that returns all user tables and views with replication state (0 if not included into publication, 1 if included):






Code Snippet

CREATE VIEW [dbo].[ViewREPL_PublishedObjects]

AS

SELECT TOP 100 PERCENT

CASE [xtype]

WHEN 'U' THEN 'Table'

WHEN 'V' THEN 'View'

ELSE NULL END AS [Object Type],

[name] AS [Object Name],

CASE WHEN [replinfo] = 0

THEN 0 ELSE 1

END AS [Replicated]

FROM [sysobjects]

WHERE

[xtype] in ('U', 'V')

AND [status] > 0

ORDER BY

(CASE [xtype]

WHEN 'U' THEN 1

WHEN 'V' THEN 2

ELSE 10

END),

[name]



Now we need to upgrade our database to SQL-2005, but [sysobjects] table have been changed, so neither Replicated state could be determined according on [replinfo] column value, nor User/System object according on [status].



So, I need a view with same functionality, that will work under SQL-2005 and 2008.



Please, help!

View 2 Replies View Related

ORDER BY In VIEW Not Working

Jan 24, 2006

I have the view below and if I use vwRouteReference as the rowsourcefor a combo box in an MS Access form or run "SELECT * FROMvwRouteReference" in SQL Query Analyzer, the rows don't come throughsorted by Numb.Everything I've read on the web suggests that including the TOPdirective should enable ORDERY BY in views. Does someone have an ideawhy the sorting is not working correctly for this particular view? thanks.CREATE VIEW vwRouteReferenceASSELECT TOP 100 PERCENT tblItem.ID,tblItem.Numb + ' - ' + tblQuestion.DescrPrimary AS FullName,tblItem.Numb, tblQuestion.DescrPrimary AS TypeFROM tblItem INNER JOIN tblQuestionON (tblItem.ID = tblQuestion.Item_ID)WHERE (((tblItem.Category_ID)>0))UNIONSELECT TOP 100 PERCENT tblItem.ID,tblItem.Numb + ' - ' + tblItem.Type + ' : ' + tblItem.Class AS FullName,tblItem.Numb, tblItem.Type + ' : ' + tblItem.Class AS TypeFROM tblItemWHERE (((tblItem.Type) = 'Assignment' OR (tblItem.Type) = 'Check' OR(tblItem.Type) = 'Route'))ORDER BY tblItem.Numb

View 49 Replies View Related

View 'order By' Not Working

Sep 22, 2006

Hi there,

I have a view created using the following code. The view works perfectly but does not order by the name column as I've asked it to do. In the view designer if I click on execute then the order is applied but if I save the view and run it externally (i.e. in an ASP page or within the management terminal) it does not order correctly and seems to order by the Id column.

Any help would be much appreciated. Here's the code:

SELECT TOP (100) PERCENT dbo.Members.DivisionID, COUNT(*) AS Members, dbo.Country.Name
FROM dbo.Members INNER JOIN
dbo.Country ON dbo.Members.DivisionID = dbo.Country.CountryID AND dbo.Members.CountryID = dbo.Country.CountryID
GROUP BY dbo.Members.DivisionID, dbo.Country.Name
ORDER BY dbo.Country.Name

And another, more simpler view, that doesn't sort as it's supposed to.

SELECT TOP (100) PERCENT CountryID, Name, RegionID, IsActive, HasFlag, URL, Comments
FROM dbo.Country
ORDER BY Name

Many thanks,

Ady

View 5 Replies View Related

SQL Server Admin 2014 :: How To Grant User Permission To View Specific Views

Aug 5, 2015

I have a user who needs access to views like(dbo.viewnameabc1,dbo.viewnameabc2 and so on...) dbo.viewnameabc* and anytime the user creates the view he already have the permission to view those views....

View 3 Replies View Related

View Not Working SQLSERVER 2000

Jul 20, 2005

Hi allWe have some tables with a couple of layers of very simple views built ontop. In the table are maybe 6 columns and about 15000 records. The firstview cobines the data in the table with some other data from a lookuptable. The second view does some sorting on the first view using certaindates . They have worked fine for well over a year now.Until this morning that is... the views stopped returning the full set ofresults- even the very simple one that sits just above the table. The viewreturned the core of the data from the main table, but nothing from thelookup table.In order to get them to work we had to delete each view (using access frontend to do this), and then recreate it with exactly the same SQL text. I amguessing this causes SQL Server to recompile it. As soon as view 1 had beenrecreated it worked, but view 2 still failed, again rebuilding view 2 itstarted working.The only thing I can think of is that this morning I added 2 new fields tothe base table, but I'm sure I've done this before without any (noticable)problems.any thoughts as to why it happened would be welcome, I am a bit nervousnow...thanksAndy

View 5 Replies View Related

Need Help On A Website Project (heavily Based On SQL Server)

Feb 26, 2007

Hi, I'm rather new here, but I would like to add the question here
since this project encompasses a lot of areas of ASP.NET (Visual Studio
2005).
My project is about a site which is heavily based on Search Option. So
basically, users will just have to fill in the forms, click search and
it will search throughout the database. For
example...
The website is about a property listing. The database (based on SQL
Server, can be created right through the Visual Studio 2005) consists
of these attributes: ID, Property Name, Property Location, Property
Cost. The user may search based on Name, Location and Cost. For the
cost, there are two forms to fill: the lowest cost allowed and the
highest cost allowed.All
these are put on the Master Page (Located on the top). When the button
Search is clicked, it will display the records that match the forms
filled, in the main page located below the Master Page.If anyone can help me with this, I'll be very grateful. Thank you very much. 

View 4 Replies View Related

Interactive Sort Not Working In Tabular View

Jun 15, 2007

I am just starting with Sql Server reporting, but I can't get interactive sort to work for columns with aggregate fields.

I am using the following query for DataSet:

SELECT
Store.ID as StoreID,
Store.Name as StoreName,
COUNT(*) as NumReservations,
SUM(Appointment.TotalBeforeTaxes) as Revenue
FROM Store LEFT JOIN Appointment ON Store.ID=Appointment.StoreID
GROUP BY ALL Store.ID, Store.Name
ORDER BY Store.Name ASC

For report, I am using tabular data view. Interactive sorting works great for StoreID, StoreName, but doesn't work for NumReservations and Revenue fields. I turned it on for all 4 columns.

What could be causing this problem?

View 1 Replies View Related

DEBATE: Moving Heavily Used Database Or Breaking-off Indexes

Feb 20, 2002

Scenario:


We run a multiple database environment, with two of the databases receiving most of the user activity. (both write and read). These databases are roughly 25gb each and receive roughly the same amount of activity. Currently both of the .mdf files sit on the same drive shelf. Their log files are located on a separate drive shelf.

Debate: We have an extra fiber channel shelf available for us to use. We are not having too many problems related to performance, but we are always seeking for different ways to increase application/server performance. The debate centers on what to do with the extra shelf. There are two different suggestions on how best to use the shelf. They are:

1)Separate the .mdf files for two most utilized databases. This would separate the databases and the I/O associated with each across two different shelves

2)Break off the indexes for all 5 databases on to the extra shelf. This would leave all the .mdf files on the same shelf, but it would move the I/O associated with the indexes to a different shelf.

Can anyone provide the pros and cons of either suggestion?
I would like to see arguements for either side.


Dave

View 2 Replies View Related

Heavily Fragmented Index - Incorrect Data Returned?

Dec 1, 2007

Hi everyone,
If I have a table with some indexes on the foriegn keys and these indexes are heavily fragmented (80%+), is it normal for queries to return incorrect results?

For example if I had a table called Customer( CustID, Name) and Orders (OrderID, CustID, Product, Date).
Lets say I have a non clustered index on CustID in Orders table, and the clustered indexes are Customer.CustID and Orders.OrderID


If the non clusterd index on Orders.CustID becomes heavily fragmented and I am querying the Orders table with TSQL "SELECT * FROM Orders where CustID = @CustID" I sometimes get missing data or incorrect results. In one case all orders for a particular year were missing, but if I queried using OderID they were returned. Rebuilding the index fixed the problem.

I know the index should be rebuilt or reorganized depending on the fragmentation but if one happened to become this fragmented should it start returning incorrect data?

- Using SQL Server Express 2005

View 3 Replies View Related

Can I Return A Value In A Variable From A SSIS Program Back To C# After The SSIS Program Is Run From C#?

May 21, 2007

Can I return a value in a variable from a SSIS program back to C# after the SSIS program is run from C#?

View 1 Replies View Related







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