Reading And Editing Sql Server 6.5 Table Contents
Aug 17, 2000What is the best way to read and edit data in the tables of a sql server 6.5 database?
Thanks
Gunnar
gunnardl@yahoo.com
What is the best way to read and edit data in the tables of a sql server 6.5 database?
Thanks
Gunnar
gunnardl@yahoo.com
Hey Guys,
Does anyone know how I can do this? I tried adding the Microsoft.Office.Interop.Excel reference to the script task but it doesn't allow me to. It only lets me pick from a selection of references that are already there (not allowing me to add new ones)
I do have this reference and have used it in VB and C# app's
If there is any other way to read an excel file please let me know, ill move onto that
Hello!
We have a SQL Server table that needs to be maintained by the actuarial department. Therefore, I was going to have them make changes to the table using something easy like Microsoft Access 2000. When I go into Access and create an ODBC link to the table, I cannot change the data. (i.e. The insert new record feature is greyed out.) I CAN change the data via Enterprise Manager, so I don't think it is SQL Server security. Any other ideas?
Thanks,
Sharon
I have a large table containing about 800 million rows with an average row length of about 1K. The columns in the table are char columns. I need to move the contents of this table into a similar table where the target columns are varchar. The original table column definitions are compatible with the target table but the reverse is not necessarily true. For example, one column is being changed from int to bigint. The table is partitioned.
So, what is the fastest way to migrate the data. I was thinking to unload each partition into a flat file and load the target table running multiple load streams? Is this a good way?
Hi All,I have come up against a wall which i cannot get over.I have an sql db where the date column is set as a varchar (i know, should have used datetime but this was done before my time and i've got to work with what is there). The majority of values are in the format dd/mm/yyyy. However, some values contain the word 'various'.I'm attempting to compare the date chosen on a c# .net page with the values in the db and also return all the 'various' values as well.I have accomplished casting the varchar to a datetime and then comparing to the selected date on the .net page. However, it errors when it comes across the 'various' entrant.Is there anyway to carry out a select statement comparing the start_date values in the db to the selected date on the .net page and also pull out all 'various' entrants at the same time without it erroring? i thought about replacing the 'various' to a date like '01/01/2010' so it doesn't stumble over the none recognised format, but am unsure of how to do it.This is how far i have got: casting the varchar column to datetime and comparing. SELECT * FROM table1 WHERE Cast(SUBSTRING(Start_Date,4,2) + '/' + SUBSTRING(Start_Date,1,2) + '/' +SUBSTRING(Start_Date,7,4) as datetime) '" + date + "'"Many thanks in advance!
View 7 Replies View RelatedHello
I want to have a print of table records in sql server express.
I went several locations, but File|Print item didn't on.
How can i print table contents in sql express environment ?
Thank you for helping me.
Is there anyway possible to edit table design with data already entered in the table.If not, is there anyway I can cut and paste the info back in. Ive tried importing to access and then back to SQL, however, when i tried to view my table design in ASP.NET webmatrix, it gave me an error.
View 1 Replies View Related
Hi,
I am relatively new to this stuff.
I am using Microsoft SQL Server Management Studio Express (9.00.1399.00)
Can someone tell me the way to get a table and its content to another database (I use two at webhosts4life)
Or perhaps a way to export the data of a table so I can do it at a later stage.
Is that at all possible with this program or do I have to use the non-express version?
Thanks in advance,
Lex
Hello, Its hard trying to explain this.
I have 3 tables
Table 1 is where the users are stored, each user has a username and a userrank
Table 2 is where the points that decides the userrank are stored
Table 3 contains the available userranks like this
Table 1 (user_list) looks briefly like this:username nvarchar(20),userrank int, -- Reference to Table3 id... alot more fields
Table 2 (settings_profile) looks like this:username nvarchar(20),total_active_points int,... some more fields
Table 3 (data_ranks) looks like this:id int primary key auto inc,rankname nvarchar(20),min_pts int,max_pts int
Points get added to table 2 whenever they do something that generates points on the site. Points also get withdrawn every 7 days, so a user can only collect points for 7 days, on the 8th day, all points he earned on the 1st day is reduced from the current points with this code:
WHILE (SELECT @username = username, @id = id, @temp1 = ap_sentmails, @temp2 = ap_createdthreads, @temp3 = ap_createdanswers, @temp4 = ap_signguestbook, @temp5 = ap_blogcomment, @temp6 = ap_createblogentry, @temp7 = ap_profilefirsttime, @temp8 = ap_profilephoto, @temp9 = ap_activateguestbook, @temp10 = ap_addnewfriend, @temp11 = ap_superguruvote, @temp12 = ap_forumtopicvote, @temp13 = ap_labervote, @temp14 = ap_funstuffitemvote, @temp15 = ap_movievote, @temp16 = ap_actorvote, @temp17 = ap_money_new WHERE (created < Dateadd(dd, -7, @todaysdate))BEGINSET @sum = 0SET @sum = @temp1 + @temp2 + @temp3 + @temp4 + @temp5 + @temp6 + @temp7 + @temp8 + @temp9 + @temp10 + @temp11 + @temp12 + @temp13 + @temp14 + @temp15 + @temp16 + @temp17UPDATE settings_profile SET total_active_points = total_active_points - @sum WHERE (username = @username)DELETE FROM konto_daylist WHERE (id = @id)END
Now my question is this, i want to loop thru the table A, collect all usernames inside of it, then run it against table b and table c to determine the current rank of the user.Something like this...
DECLARE @username nvarchar(20)DECLARE @pts int, @rank int
...something that starts a loop thru table A (user_list) and get the username into @username...
SELECT @pts = total_active_points FROM settings_profile WHERE (username = @username)-- Determine the rank here, by compairing the points the user have against the pointstabel in table data_ranksSELECT @rank = id FROM data_ranks WHERE (pts_min => @pts AND pts_max < @pts)UPDATE user_list SET rank = @rank WHERE (username = @username)
...next persion in the loop...
This SP runs once a day and will first reduce the points from 8days ago, then it will run thru all the users and determine their new rank...
But how do i loop thru all the users? with a cursor?
Is it possible to do an update * where in we update all the contents of the table after selecting specific rows of the same table.
for ex:
create table #Result(rowid int identity(1,1),cust_no int,companyname varchar(100),address varchar(200),zip varchar(9));
insert into #Result(cust_no,companyname,address,zip)
where (customertype='r' and customer.comp_id ='11')
group by customer.cust_no, customer.company
select * from #Result where customerstatus='s';
after this i want to update/replace the #Result with whatever results I have from the select statment.
Thanks for your replies.
Hi!!!
Can anybody help me with the generation of Table of Contents for a report using SQL Server 2005 Reporting Services. Let me ellaborate. The scenerio is...i m having a report of lets say 500 pages grouped on employees, showing the performance of each employee between specific date range. Now if the manager prints the report of 500 pages he will be more intersted to jump directly to a perticular employee's page which means my printed report had to have a Table of Contents on my grouped criteria (which in this case is employee number). I would really appriciate if someone can suggest me a solution for this.
For prototyping purposes, is there a tool that reads a database's schema and generates (simple) table editor that allows manual editing of data. It would be good if the tool somehow made it easy to add foreign key values to reference data e.g. gender, status, ...I can kind of do this using Management Studios "Edit Top 200 Rows", but I was wondering if there is a more user friendly tool out there.
View 3 Replies View RelatedUsing Sql Server 2005 Express and Management Studio I need to create
a SQL insert statement for the contents of a table (FullDocuments) so
that I can run the query on another server with that same table schema
(FullDocuments) and the contents will automatically be inserted into
the new instance of the FullDocuments table.In Management Studio
I have used "Script Table as" for the create table query. The
second instance of FullDocuments has been created on the remote
server. Now how do I generate an insert query for the contents of
FullDocuments so that the contents can be moved/inserted to the new
instance of the table?Thanks for any help provided.
I am trying to perform a query in SQL that will merge the contents of various table, using search criteria to narrow down the results. All of the tables have the exact same fields, and the search criteria is the same for all of them. What I am looking for is the most efficient way to perform this. I am using SQL stored procedures, and passing the results into my code. Note that in my real-world scenario there are more than three tables.
1) Merge all the tables into one and then perform the search criteria:
SELECT a, b, c FROM
(SELECT a, b, c FROM Table1
UNION ALL
SELECT a, b, c FROM Table2
UNION ALL
SELECT a, b, c FROM Table3) AS MY_MERGE
WHERE {SEARCH CRITERIA}
2) Perform the search criteria on each table and merge the results
SELECT a, b, c FROM
(SELECT a, b, c FROM Table1 WHERE {SEARCH CRITERIA}
UNION ALL
SELECT a, b, c FROM Table2 WHERE {SEARCH CRITERIA}
UNION ALL
SELECT a, b, c FROM Table3 AS MY_MERGE WHERE {SEARCH CRITERIA})
I'm copying date from a sql server 2000 table to a sql server 2008 R2 table using a Linked Server.I need to be sure the remote table is correct before processing it.I first delete all the remote table contents and after that, I insert into remote_table from local_tableWhat happens if the communication is interrupted during the insert?I mean, Can I be sure all records were copied just checking if record count > 0 ?
View 3 Replies View RelatedHi,
I've a bunch of records that may contain data that I'm after. For example:
This is a fake title [electronic resource]. 1997.
I have a very small table (~10 rows) of things like '[electronic resource]'
Is there any way to see if my record contains any of the 'target' items in the other table?
An application uses a database table having proprietary information. We do not want our customer to be able to look at that.
This being a real-time application, performance can not be sacrificed. What is the best way to keep the table data non-viewable without sacrificing the performance?
Hi All !I open a table in Query Analyzer by right clicking on it andselecting 'Open' and when the data is displayed in the view pane Iwould like to be able to edit it. It seems however that tables markedas read only (as shown on the top bar e.g. SQL Query Analyzer - [OpenTable ServerName.DBName.dbo.TableName(read-only)] ) can not be editedwhereas the one that do not have that attribute infront of the name Ican edit. Is there a way I can change the read only attribute of atable so that I can edit data directly in the view pane?Please let me know if there is !Thanks a heap ! :)Harkirat
View 2 Replies View RelatedHello:I have an Access 2K form I built from a SQL Server 7.0 view. I want tolock certain fields in the database from users so they can see them onthe views and forms, but NOT be able to edit them.I've looked in BOL, MS SQL Server web page and SQL Server 7.0 books andcould not find how to do this.Any advise will be greatly appreciated.Thanks,Richard
View 4 Replies View RelatedI am using MSSQL 2000 and trying to debug a stored procedure that has a #temp table in it. I am using the .NET SQL debugger and I would like to display or view the contents of the #temp table while debugging. Does anyone know how to do this?
View 1 Replies View RelatedI have a real table with an identity column and a trigger to populate this column.
I need to import / massage data for data loads from a different format, so I have a temp table defined that contains only the columns that are represented in the data file so I can bulk insert.
I then alter this table to add all the other columns so that it reflects all the columns in the real table. I then populate all the values so that this contains the data I need.
I then want to insert into the real table pushing the data from the temp table, however this gives me errors stating that the query returned multiple rows.
I specified all the columns in the insert grouping as well as on the select from the temp table.
ANY thoughts / comments are appreciated. This is beginning to drive me nuts.
Rob
If I have a table with three fields (A, B, C) and 'A' is a primary key, 'B' and 'C' do not have any content and another table with the same number of fields contains the same fields(A, B, C) and the fields do contain data.
I want to populate the first table with the data from the second table where the primary key 'A' is equal.
How would the sql work?
Hi,I have an Access application with linked tables via ODBC to MSSQLserver 2000.Having a weird problem, probably something i've done while not beingaware of (kinda newbie).the last 20 records (and growing)of a specific table are locked - cantchange them - ("another user is editing these records ... ").I know for a fact that no one is editing records and yet no user canedit these last records in the MDB - including the administrator -while able to add new records.Administrator able to edit records in the ADP (mssql server) where thetables are stored.Please help, the application is renedred inert .Thanks for reading,Oren.
View 3 Replies View RelatedWhen my colleague makes any change to a query containing a derived table, the word 'WITH' followed by a lot of graphical characters appears after the alias, rendering the query unusable. We have tried this with various existing and new, simple queries, all to no avail. We are editing the queries in Visual Studio 2003, and he does not get this effect when using Visual Studio 2005. I can edit the query in 2003 on my laptop with no ill effects.
Help!
Karen
What are the options to create a table of contents based on the report items in a List Control? Document Mapping works for online viewing. A table of content would make the report easier to read when it's printed.
Any help is much appreciated. Thanks.
I receive in a table a field which is an xml string
like below
<NewOrder><SiteID>CJC</SiteID><patID>458887</patID><LName>Cronin</LName><FName>tim</FName><EntryID>{7B1A4946-CEC8-4F23-AE89-5C70A6A0F9B2}</NewOrder>
Is there a way read this field with a select statement? I need to strip out the entryid value in a trigger
-- drop proc SP_Trio_Popul_Stg_Tbls1
CREATE PROC [dbo].[SP_Trio_Popul_Stg_Tbls1] @tableName varchar(20) AS
-- alter PROC [dbo].[SP_Trio_Popul_Stg_Tbls1] @tableName varchar(20) AS
declare @sql varchar (20)
set @sql = 'INSERT INTO dbo.Name_Pharse_Stg_Tbl1 (nm_last)
SELECT nm_name FROM dbo.' + quotename(@tableName)
print @sql
exec (@sql)
----------------------------------------------------------------------
exec SP_Trio_Popul_Stg_Tbls1 '00485'
----------------------------------------------------------------------
INSERT INTO dbo.Name
Server: Msg 170, Level 15, State 1, Line 1
Line 1: Incorrect syntax near 'Name'.
im trying to run this SP but im getting an error. Can you help me to fix it?
-------------------------
gongxia649
-------------------------
I need to select all the records in a table, loop through them one by one, calculating some new field data, and then write the new data back to the same table. Here is the basic structure of what I've come up with:<CODE>SqlCmd = SqlConn.CreateCommandSqlStatement = "SELECT ProductID, Name FROM tblProducts"SqlCmd.CommandText = SqlStatementSqlRdr = SqlCmd.ExecuteReaderIf SqlRdr.HasRows Then While SqlRdr.Read If SqlRdr.FieldCount > 0 Then ... SqlWriteCmd = SqlConn.CreateCommand SqlStatement = "UPDATE tblProducts SET Name = '" & NewName & "' WHERE ProductID = " & CStr(ProductID) SqlWriteCmd.CommandText = SqlStatement SqlWriteCmd.ExecuteNonQuery() SqlWriteCmd = Nothing End If End WhileEnd IfSqlRdr.Close()SqlCmd = Nothing </CODE>I get an error that tells me to close out the Reader before trying to execute the write query. But I can't close it out for the loop to work properly. So I assume that there must be another way to do this simple task, but I'm so new to all of this that I need some help! Thanks!
View 1 Replies View RelatedI have some software (written in Delphi 5) which has been working forseveral months without a problem.I have been given a copy of the database on our development server(SQL 7) and have pointed the software to this. So, nothing has changedwith the software. In theory the servers should be the same.However, if I try to make a small change to any record (as I would onthe 'live' system), I get an error stating that another user isediting the record. Now, I'm the only person with access to thisserver. So am I stopping myself I wonder ?If I create an ODBC connection to the database through Access 2000, Iget the same error. I feel I can reasonably assume that the softwareis not at fault.I'm sure it's something SQL based, whether it's an error orconfiguration difference, but I'm stuck.I've checked who is locking/blocking, and yes it will show me ashaving the record open, but this is me attempting to edit the recordso I would expect this.I can edit the table directly in SQL, but it takes 30 seconds or more,freezes EM and then allows the change. Table info below :if exists (select * from sysobjects where id =object_id(N'[dbo].[PostReceived]') and OBJECTPROPERTY(id,N'IsUserTable') = 1)drop table [dbo].[PostReceived]GOCREATE TABLE [dbo].[PostReceived] ([PostID] [int] IDENTITY (1, 1) NOT NULL ,[Type] [varchar] (100) NULL ,[ClientsName] [varchar] (100) NULL ,[DateReceived] [datetime] NULL ,[EnteredBy] [varchar] (100) NULL ,[AssignedTo] [varchar] (100) NULL ,[DateAssignedTo] [datetime] NULL ,[Adviser] [varchar] (100) NULL ,[TargetDate] [datetime] NULL ,[CompletionDate] [datetime] NULL ,[Completed] [bit] NULL ,[KeyAccount] [varchar] (100) NULL ,[Notes] [text] NULL ,[Specific1] [varchar] (20) NULL ,[Specific2] [varchar] (20) NULL ,[Specific3] [varchar] (20) NULL ,[Specific4] [varchar] (20) NULL ,[Specific5] [varchar] (20) NULL ,[ToDelete] [bit] NULL ,[EnterUser] [varchar] (20) NULL ,[Returned] [bit] NULL ,[ReturnDate] [datetime] NULL ,[ReturnReason] [varchar] (87) NULL ,[PrintAdviser] [bit] NULL ,[EmailAdviser] [bit] NULL ,[EmailSM] [bit] NULL ,[EmailRegionManager] [bit] NULL ,[ReturnText] [varchar] (150) NULL) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]GO(Yes I know about using Identity in the key, but it's on my list tochange before anyone says anything).
View 5 Replies View RelatedHi
I need to read a very big table more than 60,000 record but it is giving the following problem: But if it is small table there is no problem. Same problem also views.
Server Error in '/POBuilds' Application.
Runtime Error
Description: An application error occurred on the server. The current custom error settings for this application prevent the details of the application error from being viewed remotely (for security reasons). It could, however, be viewed by browsers running on the local server machine. Details: To enable the details of this specific error message to be viewable on remote machines, please create a <customErrors> tag within a "web.config" configuration file located in the root directory of the current web application. This <customErrors> tag should then have its "mode" attribute set to "Off".
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="Off"/>
</system.web>
</configuration>Notes: The current error page you are seeing can be replaced by a custom error page by modifying the "defaultRedirect" attribute of the application's <customErrors> configuration tag to point to a custom error page URL.
<!-- Web.Config Configuration File -->
<configuration>
<system.web>
<customErrors mode="RemoteOnly" defaultRedirect="mycustompage.htm"/>
</system.web>
</configuration>
Hi,I'm using a 3rd-party app's back end which stores SQL statements in atable, so I have no choice but to use dynamic SQL to call them (unlesssomeone else knows a workaround...)Problem is, I can't get the statement to run properly, and I can't seewhy. If I execute even a hard-coded variation likeDECLARE @sql nvarchar(MAX)SET @sql ='SELECT foo FROM foostable'sp_executesql @sqlI get: Incorrect syntax near 'sp_executesql'.If I runsp_executesql 'SELECT foo FROM foostable'I get: Procedure expects parameter '@statement' of type 'ntext/nchar/nvarchar'.which I understand, as it's omitting the N converter--so if I runsp_executesql N'SELECT foo FROM foostable'it's fine. I don't understand why the first version fails. Is it somesort of implicit conversion downgrading @sql? Every variation of CASTand CONVERT I use has no effect.This is SQL Server 2005 SP2. Thanks in advance.
View 11 Replies View RelatedI've been doing this in Access, but cannot find the answer to how to do it with SQL Server.
From a web form, a user can select a number of different dates. The selected dates are held as text (not DateTime) in an ArrayList.
Clicking the Submit button writes the contents of the form to a database table.
This works for Access:
insSQL &= "VALUES (@typEvent, @starts, @ends, @starts, @ends, @attend, @title, @room, @department, @contact, @address, @telephone, @email, @telefax, " For i = 0 to datesArray.Count - 1 insSql &= datesArray.Item(i) Next i
insSQL &= "VALUES (@typEvent, @starts, @ends, @starts, @ends, @attend, @title, @room, @department, @contact, @address, @telephone, @email, @telefax, " For i = 0 to datesArray.Count - 1 insSql &= "#" & datesArray.Item(i) & "#, " Next i
It doesn't work for SQL Server, and when trying to insert the value "01/29/2007" I get the error message: "The name '#1' is not permitted in this context. Only constants, expressions, or variables allowed here. Column names are not permitted."
I have also tried the line:
For i = 0 to datesArray.Count - 1 insSql &= satesArray.Item(i) Next i
and get: "Incorrect syntax near the keyword 'VALUES'."
I'm not sure where to find the information to correct my error.
Any help would be appreciated.
Tinker
Hello,
I am working on some maintenance work. I need a Stored procedure to read all contents of OS and SQL server log. It has to accept filename as IN parameter.
Please help me to solve this problem.
regards,
vnk.