.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
Imran Ghani
Sohaib Khalid
Post New Web Links

View data type doesn't reflect table

Posted By:      Posted Date: November 04, 2010    Points: 0   Category :Sql Server
 

I'm not sure if this is the place for this question, but here goes.

I am running SQL Server 2005, and I've encountered an issue with view data types.  I had a client who asked if they could allow for decimals in a field that was previously an integer.  This meant going and changing the column data type on a few tables from integer to float, and changing some parameters and variables within some stored procs/functions to floats.  Somewhere the value is still being rounded down, so I queried the information_schema.columns and found about 60 views in the system that reference that column and are still being considered an int, from the tables which were already converted to float.  I've found that if I simply script the views as alter and run it the column no longer is considered an int in the information schema.

My question is this: Does this seem to be my problem, that when the view is referenced the value is changed to an int? Or does the view simply reflect the table's data type and the information schema is incorrect?  If the former, is there a faster way to update all these views without going one by one and scripting them? Thanks in advance.




View Complete Post


More Related Resource Links

Entity Data Model and database view returning the same columns as there are in a table

  

When adding a stored procedure into the Entity Data Model I can select whether the procedure returns a scalar, a (new) complex type or one of the entity types I already defined. 

How do I do something similar for a view?


I mean assuming I have a view like this

CREATE VIEW FilteredFoos as SELECT Foo.* FROM Foo join ... WHERE ...

(that is a view that implements some involved filtering, but returns all columns from one table) how do I add it to the project so that I can use the entity set, but get the Foo objects, not some new FilteredFoo objects.


var foos = myDB.FilteredFoos.Include("Bar").ToList();

foreach (Foo foo in foos) { ...


Thanks, Jenda


How to create scrolling table for columns in a SharePoint Designer Data View

  

I have a fairly complex SharePoint Designer 2007 Data View they have added two more requirements.

1. Have the columns on the right side be able to scroll left to right as there is a large number of columns, while the first 3 columns on the left side stay locked in place.  This is only one list not two, and because of some other requirements I have it must remain to be just one list.

2. Then they also need to have scrolling up and down of the entire list with the headers locked in place.

The first requirement is more important than the second, but preferrably I need to do both.

I am new to XSL so not familar with the syntax. Is this something I can do on a custom Data View? Does anyone have any examples of how?

I have a drawing that show how it needs to look but I don't see an option here to upload a graphic.

So here is a link to my graphic example uploaded to my blog area: http://lindachapman.blogspot.com/  or just the image here: http://4.bp.blogspot.com/_aB01ue__NvQ/TGL42MOvrGI/AAAAAAAAAA4/c3xP4uCy4BU/s1600/Scrolling.png

I failed to mention that 3/4 of the columns are HTML Calculated fields wh

Data Source View Gives incorrect Error--Different Data Type

  
Hi, I'm creating a report model (2008 R2).  I am trying to create a relationship between two tables.  One FKs to another--same name and type (tinyint) columns.  But the Data Source View editor doesn't allow this, giving the message "...source and destination column have different data types".  But the columns are the same types.  I ahd this once before  acouple of years ago and don't remember how I got around it. Does anyong have ideas?  

Stupid developer tricks - When a data type overflow doesn't cause an overflow

  
Build a very basic cube that has a dimension with a hierarchy and a single measure.  For example, a time dimension with Year, Quarter, Month, Date along with a quantity sold.  The quantity sold is an integer in your database. Now, load up your database with test data such that the quantity when rolled up to a quarter level will be just less than the maximum value for an integer.  Process your cube and see the absolutely stupid value that gets displayed for a year. For those of you reading along and not wanting to build a cube to see what happens, here it is in a nutshell. To make the math simple, we'll use 2 billion as the max value for an int and -2 billion and the min value.  Say for example that the quantity sold for each quarter was 1 billion units.  When you look at the cube from the quarter on down, you see nice, neat POSITIVE values.  But, when you look at the quantity sold for the year, SSAS reports the quantity sold as 0. No, it didn't substitute 0 for a data type overflow (4 billion exceeds the 2 billion max).  Instead, the developer of this "feature" decided that it would be a really nice idea to just ignore the fact that you had a data type overflow and just treat the range of values as a looping structure.  So, his code said, take the aggregated value, run it all the way up to the last value in the range and tak

Analysis Service Oracle Number inconsistent Data Type for TABLE or Named Query

  
Dear Gurus, I'd VERY OLD PROBLEM. And I believe it addressed since 2006. When I design DataSource Views from Oracle Data Source. I found it return different oracle number data type for TABLE or NAMED QUERY   Provider Data Type Column Data Type Data Source View Data Type Oracle OLE DB Provider (OraOLEDB.Oracle.1) Table Number System.Int64   View Number System.Decimal   Named Querey Number System.Decimal Microsoft OLE DB Provider for Oracle (MSDAORA.1) Table Number System.Double   View Number System.Double   Named Query   1 System.Int64   Named Query   1.1234 System.Int64 Althought I know I can fix IT via MANUALLY EDIT DATASOURCE VIEW XML SOURCE. But I don't think this is a better solution. Is anybody have ideas ?  Wilson

How to put Data in multi Taxonomy type fields using Datasheet view

  
Hi, We have a requirement where data has to be uploaded to a list having a Multi Taxonomy column.Is it possible to do so using datasheet view. Or please suggest if there is any other way. Thanks, Ash

Merge replication - table with geography data type

  

Hi,

I have a problem with geography data type replication. Any change that is done on a Geography column breaks the replication - the error message is "The Merge Agent failed because the schema of the article at the Publisher does not match the schema of the article at the Subscriber." I double checked compatibility settings that is suggested here: http://social.msdn.microsoft.com/Forums/en-US/sqlreplication/thread/d8e31621-5d43-48cd-bdd3-c02b8a24625c. But both publisher and subscriber are 100RTM.

I checked synchronization logs and found a strange message - attempt to convert varchar to geography. I don't understand from where the varchar data type comes from. Tables at subscriber and publisher has the same format - geometry stored in geography data type.

2010-09-20 18:36:22.499 The Merge Agent failed because the schema of the article at the Publisher does not match the schema of the article at the Subscriber. This can occur when there are pending DDL changes waiting to be applied at the Subscriber. Restart the Merge Agent to apply the DDL changes and synchronize the subscription.
2010-09-20 18:36:22.845 Category:NULL
Source:  Merge Replication Provider
Number:  -2147199398
Message: The

Passing array or table data type

  

I need to pass many records with number of fields(i.e 5rows and 5 columns) in either array or table form to oracle for processing. Is it possible to pass array/table from asp.net pages? If no, any solutions for this? I have been thinking of passing it as string concatenated with delimiter and split it.  Seems like it is not appropriate as i have to pass 5 strings(5rows) Any better suggestion? Thanks in advance


View the data by type of authorization

  

Hi

I have a view with data
And I want to check if the user role is admin than show all items
Otherwise show only the items that the belong to the current user

        [Authorize(Roles="Member")]
        public ActionResult Index()
        {
            return View("Index", _companyRepository.GetAll());
        }
        [Authorize(Roles = "Administrator")]
        public ActionResult Index()
        {
            return View("Index", _companyRepository.GetAll());
        }
1. What the way to do it
2. Where I add the manipulation in the Model or in the controller.

 

Thanks

 


delete from one table if a combination of data doesn't exist in another

  

this will work, but i am 100% certain there's a more efficient way:

create table stgClients(intClientId int, status1 varchar(50), status2 varchar(50), status3 varchar(50))

create table lkpClientStatus(intStatusId int, vchStatusCode varchar(50), bitDeleted bit)

create table trefClientsStatus(intClientId, intStatusId)

DELETE FROM trefClientsStatus WHERE cast(intClientId as varchar(10)) + '|' + CAST(intStatusId as varchar(10)) NOT IN
SELECT cast(a.intClientId as varchar(10)) + '|' + CAST(a.intStatusId as varchar(10)) FROM
(SELECT DISTINCT sc1.intClientId, cs1.intStatusId
FROM stgClients sc1 INNER JOIN lkpClientStatuses cs1 ON (LTRIM(RTRIM(sc1.status1)) = cs1.vchStatusCode AND cs1.bitDeleted = 0)
WHERE NULLIF(LTRIM(RTRIM(sc1.status1)), '') is not null
UNION
SELECT DISTINCT sc2.intClientId, cs2.intStatusId
FROM stgClients sc2 INNER JOIN lkpClientStatuses cs2 ON (LTRIM(RTRIM(sc2.status2)) = cs2.vchStatusCode AND cs2.bitDeleted = 0)
WHERE NULLIF(LTRIM(RTRIM(sc2.status2)), '') is not null
UNION
SELECT DISTINCT sc3.intClientId, cs3.intStatusId
FROM stgClients sc3 INNER JOIN lkpClientStatuses cs3 ON (LTRIM(RTRIM(sc3.status3)) = cs3.vchStatusCode AND cs3.bitDeleted = 0)
WHERE NULLIF(LTRIM(RTRIM(sc3.status3)), '') is not null) a

yes the trims and nullifs are

Why shouldn't I snowflake a date dimension to a table in my data source view that's not a fact?

  

This is quite difficult for me to communicate so please bear with me.

I have created my data source view in my solution. I have a central fact table surrounded by the dimensions. Several of the dimensions have dates which I converted to integers. Thinking that I would need separate date dimension tables so the date integers could find their dates I created a data dimension table "snowflaked" to the dimensions with dates.

An example is my dimPolicy table has dates of creation and ending.

I converted these to integers.

A table called dimPolicycalendar was made in the DSV and then linked. A dimension snowflaked to a dimension.

When I went to create a dimension for Policy it auto attached the dimPolicyCalendar. Then all my dates disappeared. And the generic values in the dimPolicyCalendar appeared.

HELP HELP HELP PLEASE!!!

How do I get my values back?

If I wasn't supposed to add a calendar table to the dimension how will I convert those integer values to the date values I want?

I am panicking a little because I can not find any helpful resources.

You are my last hope before we are pushed to an Oracle solution. Yuck!

 

 


BJ Gordon

Checkboxes from data table

  

I have a data table that contains some values for Certifications.  This table can be updated in a different part of my application.  On the web page I am currently working on, I would like to have check boxes appear for every value in the data table.  I have been struggling with this trying to use a For Each loop and I cannot get it to work for anything.  Any suggestions? 

I am using the following Razor syntax to obtain my data (I know this works because I can display it in a WebGrid):

@{

var db = Database.Open("MyConn");

How to get data from table based on four table

  

Hi..

I need to know how to show top 30 records from four table

with fastest speed.. in ms sql server 2005..

hope You do the needfull

  


The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must

  

Hi,

This is frustrating, and I don't know how to solve it.

I have a strange problem. I am adding a LinqDatasource object, and set the context:

        protected void LinqDataSource_ContextCreating(object sender, LinqDataSourceContextEventArgs e)
        {
            e.ObjectInstance = new KaruselaDataContext(ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString);
        }


Then I get this error:
The type 'System.Data.Linq.DataContext' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089'.

 

On web.config I already have this:
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>

NOTE: The datacontext is in a different project (DLL proect) where I added a refernce to System.Data.Linq.

is there another way adding a refernce to a web project? or only though teh web.config?

Thanks.


Data Points: Deny Table Access to the Entity Framework Without Causing a Mutiny

  

Julie Lerman shows database administrators how to limit access to databases from the Entity Framework by allowing it to work only with views and stored procedures instead of tables-without impacting application code or alienating developers.

Julie Lerman

MSDN Magazine August 2010


Data Points: Windows Azure Table Storage - Not Your Father's Database

  

Let go of your traditional relational database thinking if you want to understand how Windows Azure Table storage works, says Julie Lerman. Luckily for you, she's done the hard work to grasp the new concepts and help you get up to speed.

Julie Lerman

MSDN Magazine July 2010


Under the Table: Visualizing Spatial Data

  

In this article, the author shows you three new arrivals on the SQL Server spatial visualization scene: the map control in SQL Server 2008 R2 Reporting Services (SSRS), the ESRI MapIt product, and the MapPoint Add-In for SQL Server 2008.

Bob Beauchemin

MSDN Magazine November 2009


Categories: 
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend