I am stuck on finding a solution to transpose source data from a system via a metadata look-up table into a destination table. I need a method to transpose/pivot the source data into columns (which are by various data-types). The datatypes for each column are listed in a metadata table.
Source Data Table:
Table Name: Source
SrcID AGE City Date 01 32 London 01-01-2013 02 35 Lagos 02-01-2013 03 36 NY 03-01-2013
Metadata Table:
Table Name:Metadata
MetaID Column_Name Column_type 11 AGE col_integer 22 City col_character 33 Date col_date
Destination table:
The source data to be loaded into the destination table(as shown below):
I have created a windows library control that accesses a local sql database
I tried the following strings for connecting
Dim connectionString As String = "Data Source=localhostSQLEXPRESS;Initial Catalog=TimeSheet;Trusted_Connection = true"
Dim connectionString As String = "Data Source=localhostSQLEXPRESS;Initial Catalog=TimeSheet;Integrated Security=SSPI"
I am not running the webpage in a virtual directory but in
C:Inetpubwwwrootusercontrol
and I have a simple index.html that tries to read from an sql db but throws
the error
System.Security.SecurityException: Request for the permission of type 'System.Data.SqlClient.SqlClientPermission, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' failed. at System.Security.CodeAccessSecurityEngine.Check(Object demand, StackCrawlMark& stackMark, Boolean isPermSet) at System.Security.PermissionSet.Demand() at System.Data.Common.DbConnectionOptions.DemandPermission() at System.Data.SqlClient.SqlConnection.PermissionDemand() at System.Data.SqlClient.SqlConnectionFactory.PermissionDemand(DbConnection outerConnection) at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection,
etc etc
The action that failed was: Demand The type of the first permission that failed was: System.Data.SqlClient.SqlClientPermission The Zone of the assembly that failed was: Trusted
I looked into the .net config utility but it says unrestricted and I tried adding it to the trusted internet zones in ie options security
I think that a windows form connecting to a sql database running in a webpage should be simple
Okay, most peoples answer to this may be "Gaaah. Why would you dothis?", or the like, but here's the question anyway:Are there any stability issues if I mark one of my user tables as asystem table (by switching xtype in sysobjects from 'S' to 'U')?I'm not doing this as "a cleved bit of security" or some such - myactual reason for doing this is so that some of my automatic generationtools do not process this particular table, and I want a method thatwill not mean updating each of the tools if I ever add another tablelike this.It APPEARS to work, based on a quick trial, but has anybody got anydirect experience of this? Any horror stories like "Well, it workedfine for two weeks, then it shot my co-workers, set fire to the companyaccounts, and urinated in a corner. Then things got worse"Also, yes, yes, yes, I do not necessarily expect this to work in futurereleases of SQL Server (currently on 2000), but I should avoid namingconflicts by the fact that the owner isn't dbo.Thanks in advance for any insights.
I have a corrupt syscolumns table and have no good backups :(
I get message 7930, Level 16, State 1. Table Corrupt; keys in left child is not less than the parent key; check left child page 15491....
The end result is the appearance that a column is missing from one of my tables. In otherwords, I know the table is supposed to have col1, but when I select data from the table, col1 does not show up....dbcc checkdb gave me the error above.
I'm trying to find the differences between two of my databases. I've noticed that some of my stored procedures were created with ANSI_NULLS on in one database and off in another database. Turns out that a tool that one of the developers is using doesn't set that correctly. Anyway... I've figured out that in the column "status" in sysobjects a bit is used to store the ANSI_NULLS setting at the time the stored procedure was created. I've also noticed that when I set two stored procedures to both use ANSI_NULLS on they sometimes still have different values in "status". Does anyone know (or know where I can find out) the bitmapping for this column?
In all of the Microsoft documentation the description for this column merely states that it is for "internal use". What a big help. A resource with all of the bitmap definitions in the system tables would really be great.
ren writes "the error first appeared in error log as
I/O error (bad page ID) detected during read at offset 0x0000007852a000 in file 'I:RD1DATA7RD1DATA7.ndf'..
DBCC checkdb return message
Database 'dbname' consistency errors in sysobjects, sysindexes, syscolumns, or systypes prevent further CHECKDB processing.
dbcc checktable ('syscolumns') returned
Server: Msg 8928, Level 16, State 1, Line 1 Object ID 3, index ID 0: Page (10:621247) could not be processed. See other errors for details. Server: Msg 8939, Level 16, State 1, Line 1 Table error: Object ID 1185438913, index ID 0, page (10:621247). Test (!(m_flagBits & PG_ALIGNED4)) failed. Values are 16386 and 1185438913. Server: Msg 8940, Level 16, State 1, Line 1 Table error: Object ID 1185438913, index ID 0, page (10:621247). Test (IsAligned (m_freeData)) failed. Address 0x2ad is not aligned. DBCC results for 'syscolumns'. There are 11744838 rows in 188015 pages for object 'syscolumns'. CHECKTABLE found 0 allocation errors and 1 consistency errors in table 'syscolumns' (object ID 3). CHECKTABLE found 0 allocation errors and 2 consistency errors in table '(Object ID 1185438913)' (object ID 1185438913). repair_allow_data_loss is the minimum repair level for the errors found by DBCC CHECKTABLE (RD1.dbo.syscolumns ).
Since the repair option requires single user mode, it will have big impact on the user. Is the I/O error (bad page ID) on the file a hardware failure? If not, what would cause this problem.
Hi,Is there a way to hide the system tables created in each SQL serverdatabase (ie. dtproperties, sysindexes). It's not a big deal, but I'dlike to see only the tables I create.
How do I get a System Table like 'Sysobjects' into the Data Access Layer? My app generates tables on the fly, and has to check in the sysobjects table which tables are present.
I run dbcc checkdb on one of my databases and I get the following message....
Server: Msg 2511, Level 16, State 1, Line 0 Table Corrupt: Object ID 12, Index ID 0. Keys out of order on page (1:7364), slots 120 and 121. CHECKDB found 0 allocation errors and 1 consistency errors in table 'sysdepends' (object ID 12). CHECKDB found 0 allocation errors and 1 consistency errors in database 'DMBEN'. repair_fast is the minimum repair level for the errors found by DBCC CHECKDB (DMBEN ).
I then run dbcc checkdb ('DMBEN',repair_rebuild) with no_infomsgs and I get the same messages...nothing was fixed.
Any ideas what I can do now. I tried dropping and recreating the index but the problem is on a system database and SQL won't let me drop the index.
Hi, Is it possible to store the output of a SQL Server 7.0/6.5 System Stored Procedure (eg. xp_fixeddrives, sp_spaceused, etc.) in a table, possibly with a Select Into? All help will be greatly appreciated. Thanx in advance. Craig
I am looking for feedback on the following situation :) please leave your thoughts.
Little history: 1)We are in the process of migrating some of our applications from SQL 6.5 to SQL 2k. 2)The application was written to access the system tables directly under 6.5 (don't look at me, I know microsofts standing on this, i'm just the dba not the dev)
The situation is this: The SQL 6.5 to SQL 2k migration is going great, no problems there...
The problem is the change to Unicode for system tables etc. So when they try to run the app it freaks out when it trys to access the data in the system tables getting unicode returned instead of text.
I know Unicode is the underlying arcitecture of SQL 7.0, 2k and so on but does anyone know any possible way or trick to get around this without altering the application code?
As a DBA I have not seen or heard of being able to do anything of the sort but I have to ask to make sure there is nothing I have over looked. This is more a matter of C.Y.A. ;)
Unicode in SQL2K http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnsql2k/html/sql_dataencoding.asp 6.5 vs 7.0 and the system table changes http://www.windowsitpro.com/Article/ArticleID/5658/5658.html?Ad=1
Hi all, Im not really sure if this is a PHP or and SQL problem but here goes.
Im using MSSQL and have developed a webpage that enables users to run various PACKAGES manually, however I need to display if the package has been successfully run.
Is there a system table that logs package information or is there a PHP function that I can use.
Thanks
P.s I know there are some system tables with the information for jobs but I do not want to create a job for each package.
I am preparing to design an application that will archive files created by another application. In my SQL database I want to store details about the file and then the file its self. Each file is about 500kb in size and there will be about 20,000 files generated per year.
My preference is to store these files in a blob field. It makes storage, linking to file meta data, backup etc easy for me. I have already solved the technical issues surrounding pulling the file in and out of a blob field.
By my calculations I will need a server with 10GB of disk space for each year of files archived which doesn't seem outlandish for table size.
I do not want to design my application however to find out a year from now that I should have been storing these files in a traditional file system because of (... whatever ...) and just linking them by path in the sql database.
I'm curious what users of this forum believe to be the best practices surrounding this type of database?
I hope you can help as I am really scratching my head on this one. I am pulling together an assessment of the Disaster Recovery readiness for an organisation I am working at. Part of the assessment I am doing is the recovery model of each of the databases.
I have scripts that are already pulling lots of data from 40+ servers and 500+ databases. However, I cannot seem to find anywhere within the MASTER or MSDB or the database itself where the Recovery Model flag is held. Obviously I can right click on the database and click properties and it is there, but I need to automate this task (as it will probably be a weekly assessment).
I have checked sysdatabases and almost every other table, but nothing obvious as to where this flag is.
Is the connection manager/connection string data that is visible in a SSIS Job Step on the Data sources tab stored in a system table or DMV? Perhaps the agent service parses the SSIS package in order to display this information? We're trying to identify all of the dependencies on a specific database and the only dependency type that we can't identify systematically is SSIS package data sources.
We use package configurations (of type = SQL Server database) for some packages but not all packages are using this.
I need to count the records in a table with a datetime field equal to system datetime. It looks like it is trying to match time also since time is in field too. I just want to match date only. My sql is below. Does anyone have some suggestions on how to handle this? Date from code
DateTime todaydt = DateTime.Now;
Table Data format
[cal_str_tm] [datetime] not null, Data in cal_str_tm field - 3/27/2008 9:43:16 PM
Thanks, Ron
ALTER PROCEDURE SP_DpCount
(
@todaydt datetime
)
AS
SELECT @total = COUNT(cal_int_id)
from dpcalldtl
where (cal_callstat != 'COMPLETED' and cal_str_tm = @todaydt)
is there a way to get a count of records for each table in a database by table in one query? I can query each table using a count, but this is pretty tedious when you have 50+ tables. Anybody have any ideas?
Does anyone know where I can get a digram showing the database schemas for all of the system database. I need to know the realtionship between tables in the system databases. Would like to download something from the internet preferably, or if someone has something they can e-mail?