Simple System Table Question
Jul 20, 2005Hi,
Is there a way to hide the system tables created in each SQL server
database (ie. dtproperties, sysindexes). It's not a big deal, but I'd
like to see only the tables I create.
Hi,
Is there a way to hide the system tables created in each SQL server
database (ie. dtproperties, sysindexes). It's not a big deal, but I'd
like to see only the tables I create.
Is there any Posibility to change a User Table to System Table.
How to create one system table.
I am in Big mess that One of the Table I am using is in System Type.
I cant Index the same. Is there any Mistake we can change a user table to system table.....
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):
Table Name: Destination
SrcID MetaID col_int col_char col_date
01 11 32 - -
01 22 - London -
01 33 - - 01-01-2013
02 11 35 - -
02 22 - Lagos -
02 33 - - 02-01-2013
03 11 36 - -
03 22 - NY -
03 33 - - 03-01-2013
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
to configure what am I missing?
I am adding this to my c#.Net app...How can I sort all rows in a table?After it is sorted, will it remain so after i do a cnSQL.Close();so that when I then do a:string strSQL = "SELECT InvoiceNumber " +"FROM tblPrintInvoice " ;Is it still sorted for me to do a:drSQL.Read?Thanks,Trint
View 2 Replies View RelatedI have a problem with getting SSRS to do exactly what I want it to do. My report is fairly simple in that it is a header a detail row and a footer for totals. I have an Oracle stored procedure pass the table of information to SSRS and no matter how I pass the information I cannot get SSRS to do what I want it to do. Heres the problem.
Lets say I have 3 pieces of information. The customers name, customers SSN, and their Institution. For every customer the name and SSN will stay the same but each customer can belong to multiple institutions. So, I wanted to have a basic table display their name, their SSN and their Institution on one row and if they belong to more than 1 institution the following institutions will be displayed on the following rows.
I've tried grouping by SSN but that just only displays the SSN once and only the first institution in that group and ignores showing the other institutions. I've also tried grouping the SSN and name in the group header and then played around with putting the Institutions in the details but I cant get that first Institution to appear on the first row with the Name and SSN.
I'm at a loss here and this seems like it should be a simple solution but I cant figure it out. I'm know there must be a way because this is a really basic fundamental that I'm trying to accomplish and is probably used in many reports.
Hope someone can help me.
-Evan
i realize this is a basic question, but i'd like advise on the best way to create a table to store financial time series data. i already have a table to store securityid which is the primary key. However, when i move over to the table to store time series, i will have many secid as well as different dates and types of data. what should my primary key-autonumbered or concatenated from secid and date etc...in addition, i want to have a good way to query the table to make sure there are no dupes (same secid and same data etc). many thanks
View 1 Replies View RelatedHi i have three tables
T1 is a table of data imported by DTS, it has staff numbers and location names
T2 is a table that contains system data about staff and has a column for the location id
T3 is a table for the location names and their ID's
i am trying to write the sql to update T2 with the new location IDs for staff that have moved location but am not getting what i need.
so far i have :
update
T2
set T2.LocationId =T3.LocationID
from T3
inner join T1
on T3.departmentname = T1.contact_location
the update runs but sets all rows to the same value. am now burried deep in the [I've stared at this too long and cant see the wood for the trees] stage :mad:
Thanks
FatherJack
greets all, ive got a table with batches of records. each group of records has a batch id as part of the PK in the form BTCXXXX where XXXX is an auto-incremented number. so lets say i have 100 batches of 20k records per batch in the table. so the distinct batch ids are BTC0200 (oldest batch) through BTC0300 (newest batch).
i only want to keep the 90 most recent batches in the table at any given time.
is it ok to just subtract 90 from the last batch id and do something like:
DECLARE @batch_id char(10)
SET @batch_id = 'BTC' + batch_num-90
DELETE FROM ITEM_BATCH
WHERE BATCH_ID < @batch_id
i want to cover if the table has more than 90 batches and if the table has less then 90 batches. is this a feasible approach?
I am trying to build a simple time table and pre-populate the rows for lets say 1 year. Basically, I will be extracting the data froma source based on the boundaries of this table. eg of this table as I can visualize:
Date StartTime Endtime IsProcessed
2014-06-17 2014-06-17 00:00:00 2014-06-17 01:00:00 0
2014-06-17 2014-06-17 01:00:00 2014-06-17 02:00:00 0
2014-06-17 2014-06-17 02:00:00 2014-06-17 03:00:00 0
Lets call this TimeTable and we have our souce and destination table..The ETL process will pick the start time and endtime, will pass these as parameters to the source and extract the data as follows:
Insert into Destination
select * from source where entrydate>=TimeTable.StartTime and entrydate<TimeTable.EndTime
Once this data gets loaded, the IsProcessed field is set to 1 so that next time it won't be considered.I am trying an incremental load process here.
I have a database with three tablestbl_listings - listings of houses on for saletbl_intersted - table which tracks if a user is interested in thelisting, it has two columns mls(the key for tbl_listings) and user(userlogin)tbl_review - table which trackes if a user has reviewed the listing.Like tbl_interested it has two columns (the key for tbl_listings) anduser(user login)How can I create a query on tbl_listings for reocords reviewed by oneuser?I am trying to create a query for listings that are revied by useruserid. I am using the query below. It works fine unless there is arecord in tbl_interested for a differnt user.In reality I am calling this query from the web. On the website I havean intersted dropdown with the choices All, interested, not interested.The website also has a reviewed dropdown with all, reviewed and notreviewed.I am using the query below as a starting point. my query works finewith one user, but if a user2 enters a record in tbl_intersted itthrows off the left join for user1. How can I fix this?SELECT COUNT(B.reviewed) AS review_count,Count(B.mls) as mls_count,A.mls,FROM mls.tbl_listings ALEFT OUTER JOIN mls.tbl_review B ON A.mls = B.mlsLEFT OUTER JOIN mls.tbl_interested D ON A.mls = D.mlswhere (B.reviewed = 'userid') and ((D.interested is null) or(D.interested = 'userid'))----My query works fine if there is one user, however once user2 reviews arecord from tbl_listing user1
View 2 Replies View Relatedusing SQL (server man studio) EXPRESS
when I create a table
I only see... (col-column)
col name ; Data type ; ALLOW NULLS
how can I set the length of an integer field
or is it because it is so express, I just have to set up the data type -- such as integer
M A N Y THANKS
...but apparently not me, I'm very new with this T-SQL stuff and am seeking the advice of the seasoned pros at this forum.
Description on my SQL-5 Environment:
Table I Sales: Prod_ID, Prod_DT, Sales_DT, Buyer_Name, Buyer_State
Table II Repairs: Prod_ID, Prod_DT, Sales_DT, Repair_DT
These 2 tables are joined by the common key Prod_ID & also and share the product's production & sales dates. What I would like to do is produce a rate summary similar to description below.
Production_YYYY, Production_MM, Sales_Cnt, Repairs_Cnt, Repair_Rate((Repairs_CNT/Sales_CNT)*100)
Important to remember that not all products experience repairs, so the basis for Sales_CNT needs to be the Sales Table, even thou Prod_DT also appears in Repairs Table.
It's simple enough for novice like me to produce 2 tables independently and then merge back those resulting tables into the single table output described above. But my question is how do I write a single SQL "SELECT" request that will produce the results into just a single table.
Thanks in advance for your help!
Hi Guys,I have the following query: SELECT DecisionSessionID, RuleID, Operator1, Criteria1, AttributeForCriteria1, Operator2, Criteria2, AttributeForCriteria2, Operator3, Criteria3,
AttributeForCriteria3, Result
FROM myTable
WHERE (SessionID = @SessionID) Now I want that instead of the complicated Criteria1, Crieria 2 and Criteria 3 values the users sees the names whichare defined in myCriteria. I though the query might then look like this SELECT
DecisionSessionID,
RuleID,
Operator1,
Criteria1 (SELECT CriteriaName FROM myCriteria WHERE Criteria1 = CriteriaID),
AttributeForCriteria1,
Operator2,
Criteria2 (SELECT CriteriaName FROM myCriteria WHERE Criteria2 = CriteriaID).
AttributeForCriteria2,
Operator3,
Criteria3 (SELECT CriteriaName FROM myCriteria WHERE Criteria3 = CriteriaID),
AttributeForCriteria3,
Result
FROM dbo.aspnet_FuzzyRules
WHERE (DecisionSessionID = @DecisionSessionID) I am not very familiar with the sql syntax and as you can imagine the above psyeudo version is not really working.Do you know how the correct syntax for such a nested query would look like?many thanks,polynaux
I am trying to write a simple search page that will search all the fields in a database to find all records that match a user input string. The string could happen anywhere in any of the fields. I have a dataset and can write a query but am unsure what the format is for this simple task. I figured it would look like this:
SELECT Table.*
FROM Table
WHERE * = @USERINPUT
But thats not working. Can someone help.? Thanks..
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.
View 3 Replies View RelatedI suspect I have a but in a stored procedure that is used to delete records in a table. Here's the code for the gridview and its SQLDataSource
1 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
2 DataKeyNames="table2_id" DataSourceID="SqlDataSource1">
3 <Columns>
4 <asp:CommandField ShowDeleteButton="True" ShowSelectButton="True" />
5 <asp:BoundField DataField="table2_id" HeaderText="table2_id"
6 InsertVisible="False" ReadOnly="True" SortExpression="table2_id" />
7 <asp:BoundField DataField="table1_id" HeaderText="table1_id"
8 SortExpression="table1_id" />
9 <asp:BoundField DataField="name_2" HeaderText="name_2"
10 SortExpression="name_2" />
11 <asp:CheckBoxField DataField="yesno" HeaderText="yesno"
12 SortExpression="yesno" />
13 <asp:BoundField DataField="MyArtificialColumn" HeaderText="MyArtificialColumn"
14 ReadOnly="True" SortExpression="MyArtificialColumn" />
15 </Columns>
16 </asp:GridView>
17 <asp:SqlDataSource ID="SqlDataSource1" runat="server"
18 ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>"
19 DeleteCommand="EraseIt" DeleteCommandType="StoredProcedure"
20 SelectCommand="StoredProcedure5" SelectCommandType="StoredProcedure">
21 </asp:SqlDataSource>
Recently, "Wreck of u" kindly provided me with the stored procedure "StoredProcedure5" (line 20) which populates the gridview as shown. What I would like to now is write a stored procedure that DELETES a row. As like 19 shows, I attempted to write such an SP called EraseIt. However, when I click on Delete in the browser for a row, I get the error message "Procedure EraseIt has no parameters and arguments were supplied. The following is the code for EraseIt. Do I in fact have an error with specifying the input parameter "@table2_id", and or am I doing something else wrong? 1 ALTER PROCEDURE [dbo].[EraseIt]
2 AS
3 DECLARE @TABLE2_ID int
4 BEGIN
5 DELETE FROM DBO.TABLE2 WHERE TABLE2_ID = @TABLE2_ID
6 END
7
Thanks!-Kurt
In my database/MY SERVER (SQL7/Win2K), I run a simple query with a Table/10000 rows (without cluster index):
SELECT * FROM TABLE
it take over 30s. Why it's slow? How can I check for reason? How to configure my server to improve performance?
Thanks in advance.
TH
----------------------------------
SP_CONFIGURE's RESULT in MY SERVER
----------------------------------
Table 'spt_values'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 0.
name minimum maximum config_value run_value
----------------------------------- ----------- ----------- ------------ -----------
affinity mask 0 2147483647 0 0
allow updates 0 1 1 1
cost threshold for parallelism 0 32767 5 5
cursor threshold -1 2147483647 -1 -1
default language 0 9999 0 0
default sortorder id 0 255 52 52
extended memory size (MB) 0 2147483647 0 0
fill factor (%) 0 100 0 0
index create memory (KB) 704 1600000 0 0
language in cache 3 100 3 3
language neutral full-text 0 1 0 0
lightweight pooling 0 1 0 0
locks 5000 2147483647 0 0
max async IO 1 255 32 32
max degree of parallelism 0 32 0 0
max server memory (MB) 4 2147483647 2147483647 2147483647
max text repl size (B) 0 2147483647 65536 65536
max worker threads 10 1024 255 255
media retention 0 365 0 0
min memory per query (KB) 512 2147483647 1024 1024
min server memory (MB) 0 2147483647 0 0
nested triggers 0 1 1 1
network packet size (B) 512 65535 4096 4096
open objects 0 2147483647 0 0
priority boost 0 1 1 1
query governor cost limit 0 2147483647 0 0
query wait (s) -1 2147483647 -1 -1
recovery interval (min) 0 32767 0 0
remote access 0 1 1 1
remote login timeout (s) 0 2147483647 5 5
remote proc trans 0 1 0 0
remote query timeout (s) 0 2147483647 0 0
resource timeout (s) 5 2147483647 10 10
scan for startup procs 0 1 0 0
set working set size 0 1 0 0
show advanced options 0 1 1 1
spin counter 1 2147483647 10000 10000
time slice (ms) 50 1000 100 100
two digit year cutoff 1753 9999 2049 2049
Unicode comparison style 0 2147483647 196609 196609
Unicode locale id 0 2147483647 1033 1033
user connections 0 32767 0 0
user options 0 4095 0 0
Table 'spt_values'. Scan count 43, logical reads 108, physical reads 0, read-ahead reads 0.
Table 'sysconfigures'. Scan count 1, logical reads 2, physical reads 0, read-ahead reads 2.
I want my query to list all SSNS that have more than one record in the table. I have this query:
Code:
SELECT SSN, name4, count(*) from [1099_PER]
group by SSN, name4
having count(SSN) > 1
It does retrieve the right SSNS and tells me how many times the SSN occurs in the table. However, I want my query results to display their full records.
For example
SSN NAME4 COUNT
123445555 WALTER - 4
I want the query to show me all four records for this SSN. I thought removing the count field would do this, but it still gives me only one instance of each SSN.
Hi,
We are seeing memory issues with a simple C# based TVF that splits an input string into a table based a delimiter. Entries such as the following show up in the SQL log:
AppDomain 8 (DBName.dbo[runtime].7) is marked for unload due to memory pressure.
AppDomain 8 (DBName.dbo[runtime].7) unloaded.
These entries only show up after the TVF has been called many times (~ half million times or more).
We encountered the same memory issues with June CTP, but they appeared to be fixed in Sepetmber CTP. Somehow the issues come back for us in the SQL Server 2005 RTM version. With June CTP after these errors show up many many times, the SQL server had to be re-started.
I'd appreciate any comments/ideas regarding these error messages in the SQL log?
We are using the RTM version of SQL2005: Microsoft SQL Server 2005 - 9.00.1399.06 (Intel X86)
Oct 14 2005 00:33:37
Copyright (c) 1988-2005 Microsoft Corporation
Enterprise Edition on Windows NT 5.2 (Build 3790: Service Pack 1)
Thanks,
Wenbin Zhang
I would like to put an insert trigger on sysdatabases. Is this possible?
Thanks!
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.
thanks in advance!
Dean
Hi,
I want to create a trigger on sysfiles. I had logged in as sa account but able to create it... I am getting the below error...
Server: Msg 229, Level 14, State 5, Procedure TAU_Sysfiles_WSCLog_Reminder, Line 65535
CREATE TRIGGER permission denied on object 'sysfiles', database 'WorldScope_Dev', owner 'dbo'.
Can any body please help me how to go ahead creating trigger in the system tables...
Thanks in Advance...
-Mohit.
Hi,
Can I create trigger on a system table in the Master database, what I need is to create trigger on sysxlogins table.
Thanks
I find this a good tool... just want to pass it along.
http://www.microsoft.com/sql/techinfo/productdoc/2000/systables.asp
hiroshi writes "pls tell me about all function of system table"
View 4 Replies View RelatedHi,
How to put a resultset of a System Stored Procedure into a table?.
For Ex,
I want to put the result of sp_Databases into a table
Hi everybody... I want know in witch one system table can I found the description for the memberid field in the sysmembers table
I supose than memberid = 16384 is a db_owner, but I don't know what means all others numbers.
Tks 4 help.
Jack
I got some xml that is essentially an html table that I need to turn into a standard table resultset from a stored proc. If you take this xml and save it as html that is the desired resultset I am looking for. I realize the <td> tags repeat so I would just prefer 'col' + positional index for the col name. Keep in mind that <td> could be is 1 to n.
<table>
<tr>
<td>cell1</td>
<td>cell2</td>
<td>cell3</td>
[Code] .....
This is my attempt but I can't figure out how to get separate cols
declare @GridData xml = '<table><tr><td>cell1</td><td>cell2</td><td>cell3</td></tr><tr><td>cell4</td><td>cell5</td><td>cell6</td></tr><tr><td>cell7</td><td>cell8</td><td>cell8</td></tr></table>'
select T.C.value('.', 'nvarchar(max)')
from @GridData.nodes('//tr') T(C)
Today I need to copy 8 records in a table. I have to use Access 200 becauseof the limitation of Enterprise Manager's inability to cope with field withmore than 900 characters. Selected records, cut, paste. I got an erroormessage about not being able to have a null Key_ID (I copied the reords andtried to paste the Key_ID as part of the records - normally I hide theKey_ID).Now I can't access either the new records or the originals that I was tryingto copy (because, it would seem, they have identical primary keys). I alsocannot export the table via DTS 'unspecified error' and 'integrityviolation'.Or delete the offending records with a Query Anaylyser delete query.Basically the entire SQL Server database has been destroyed with a couple ofkeystrokes.Now, I've being developing database applications for over 20years and theone thing, maybe the only thing I expect from a database server is toprotect the integrity of my data. SQL Server does not, it would seem. Theserecords aren't just any random unimportant records either. They contain the'create views' that my entire application require to function and each oneapproaches the 8000 record limit and have take years to perfect and justchecking that the table is valid could take me days.
View 5 Replies View RelatedHi, I'm trying to build a several tables using sql ce 3.1
I refer to the manual on Create Table:
ms-help://MS.SSCE.v31.EN/ssmprog3/html/143cad25-5c1d-4c96-bd8b-6a95dbfb1b00.htm
The sample:
CREATE TABLE MyCustomers (CustID int IDENTITY (100,1) PRIMARY KEY,
CompanyName nvarchar (50))
just simply doesn't work displaying this error:
SQL Execution Error
Executed statement: CREATE TABLE MyCustomers (CustID int IDENTITY (100,1) PRIMARY KEY,
CompanyName nvarchar (50))
Error Source: SQL Server Compact Edition ADO.Net Data Provider
Error Message: There was an error parsing the query. [Token line number =1,
Token line offset 40, Token in error=IDENTITY]
I tested against a SQL Desktop, everything is OK.
What's wrong with the sentence?
Please some advise or workaround will be appreciated
Thanks
MSCD Fernando Zorrilla de San MartÃn
This is the error I get with a simple Data Reader Source (SELECT * FROM A) to SQL Server Destination copy between identical tables from a linked to a local server:
View 6 Replies View Relatedfound it
View 3 Replies View Related