IDs For Insert And Modified Fields
Jan 21, 2015
if you all add ID's with your Inserts and Modified (Date) fields. Such as 1 would indicate if the record was inserted manually, whereas 2 might indicate it was update or inserted by a web application.
View 2 Replies
ADVERTISEMENT
Apr 21, 2008
An insert statement was not inserting all the data into a table. Found it very strange as the other fields in the row were inserted. I ran SQL profiler and found that sql statement had all the fields in the insert statement but some of the fields were not inserted. Below is the sql statement which is created dyanmically by a asp.net C# class. The columns which are not inserted are 'totaltax' and 'totalamount' ...while the 'shipto_name' etc...were inserted.there were not errors thrown. The sql from the code cannot be shown here as it is dynamically built referencing C# class files.It works fine on another test database which uses the same dlls. The only difference i found was the difference in date formats..@totalamount=1625.62,@totaltax=125.62are not inserted into the database.Below is the statement copied from SQL profiler.exec sp_executesql N'INSERT INTO salesorder(billto_city, billto_country, billto_line1, billto_line2, billto_name,billto_postalcode, billto_stateorprovince, billto_telephone, contactid, CreatedOn, customerid, customeridtype,DeletionStateCode, discountamount, discountpercentage, ModifiedOn, name, ordernumber,pricelevelid, salesorderId, shipto_city, shipto_country,shipto_line1, shipto_line2, shipto_name, shipto_postalcode, shipto_stateorprovince,shipto_telephone, StateCode, submitdate, totalamount,totallineitemamount, totaltax ) VALUES(@billto_city, @billto_country, @billto_line1, @billto_line2,@billto_name, @billto_postalcode, @billto_stateorprovince, @billto_telephone, @contactid, @CreatedOn, @customerid,@customeridtype, @DeletionStateCode, @discountamount,@discountpercentage, @ModifiedOn, @name, @ordernumber, @pricelevelid, @salesorderId,@shipto_city, @shipto_country, @shipto_line1, @shipto_line2,@shipto_name, @shipto_postalcode, @shipto_stateorprovince, @shipto_telephone,@StateCode, @submitdate, @totalamount, @totallineitemamount, @totaltax)',N'@billto_city nvarchar(8),@billto_country nvarchar(13),@billto_line1 nvarchar(3),@billto_line2 nvarchar(4),@billto_name nvarchar(15),@billto_postalcode nvarchar(5),@billto_stateorprovince nvarchar(8),@billto_telephone nvarchar(3),@contactid uniqueidentifier,@CreatedOn datetime,@customerid uniqueidentifier,@customeridtype int,@DeletionStateCode int,@discountamount decimal(1,0),@discountpercentage decimal(1,0),@ModifiedOn datetime,@name nvarchar(33),@ordernumber nvarchar(18),@pricelevelid uniqueidentifier,@salesorderId uniqueidentifier,@shipto_city nvarchar(8),@shipto_country nvarchar(13),@shipto_line1 nvarchar(3),@shipto_line2 nvarchar(4),@shipto_name nvarchar(15),@shipto_postalcode nvarchar(5),@shipto_stateorprovince nvarchar(8),@shipto_telephone nvarchar(3),@StateCode int,@submitdate datetime,@totalamount decimal(6,2),@totallineitemamount decimal(6,2),@totaltax decimal(5,2)',@billto_city=N'New York',@billto_country=N'United States',@billto_line1=N'454',@billto_line2=N'Road',@billto_name=N'Hillary Clinton',@billto_postalcode=N'10001',@billto_stateorprovince=N'New York',@billto_telephone=N'124',@contactid='8DAFE298-3A25-42EE-B208-0B79DE653B61',@CreatedOn=''2008-04-18 13:37:12:013'',@customerid='8DAFE298-3A25-42EE-B208-0B79DE653B61',@customeridtype=2,@DeletionStateCode=0,@discountamount=0,@discountpercentage=0,@ModifiedOn=''2008-04-18 13:37:12:013'',@name=N'E-Commerce Order (Before billing)',@ordernumber=N'BRKV-CC-OKRW5764YS',@pricelevelid='B74DB28B-AA8F-DC11-B289-000423B63B71',@salesorderId='9CD0E11A-5A6D-4584-BC3E-4292EBA6ED24',@shipto_city=N'New York',@shipto_country=N'United States',@shipto_line1=N'454',@shipto_line2=N'Road',@shipto_name=N'Hillary Clinton',@shipto_postalcode=N'10001',@shipto_stateorprovince=N'New York',@shipto_telephone=N'124',@StateCode=0,@submitdate=''2008-04-18 14:37:10:140'',@totalamount=1625.62,@totallineitemamount=1500.00,@totaltax=125.62
thanks
View 7 Replies
View Related
Feb 4, 2008
I have created 2 tables and populated them with data. When doing an inert into #JoblistTable from #EquentialJobListTable, fields are not mapped correctly. Example: qty_delivered in #JobListTable is filled with data from qty_received from #EquetialJobListTable?
CREATE TABLE#JobListTable
(
job_date datetime,
job_number char(15),
cost_code char(15),
qty_delivered decimal(8,2),
qty_received decimal(8,2),
qty_used decimal(8,2),
qty_wasted decimal(8,2),
plant_id char(10)
)
Fill table.........
CREATE TABLE#EquentialJobListTable
(
job_date datetime,
job_number char(15),
cost_code char(15),
qty_received decimal(8,2),
qty_used decimal(8,2),
qty_wasted decimal(8,2),
plant_id char(10)
)
Fill table .......
INSERT#JobListTable
(
job_date,
job_number,
cost_code,
qty_delivered,
qty_received,
qty_used,
qty_wasted,
plant_id
)
SELECTt2.job_date,
t2.job_number,
t2.cost_code,
t2.qty_received,
t2.qty_used,
t2.qty_wasted,
t2.plant_id,
case
when t2.plant_id = 320 then 'RGFP'
when t2.plant_id = 300 then 'RGWP'
when t2.plant_id = 600 then 'RGDF'
when t2.plant_id = 330 then 'RGGT'
when t2.plant_id = 350 then 'RGWG'
when t2.plant_id = 340 then 'RGDB'
when t2.plant_id = 610 then 'RGMI'
when t2.plant_id = 110 then 'SBGB2'
end
FROM#EquentialJobListTable AS t2
LEFT JOIN#JobListTable AS t1 ON
t1.job_date = t2.job_date
AND t1.job_number = t2.job_number
AND t1.cost_code = t2.cost_code
WHEREt1.job_date IS NULL
View 2 Replies
View Related
May 30, 2004
Hi,
I am trying to do a bulk insert using a text file that is comma delimited.
In the text file there are fields which are surrounded by quotes and contain commas; these commans should not be considered delimiters.
Is there a way to tell the BULK INSERT statement not to treat these as delimiters?
thanks,
sivilian
View 2 Replies
View Related
Apr 18, 2008
I've found out how to to the Insert into my table (col1, col2) Select (col1, col2...) from othertable where regId= @regId in my earlier question but do i have to name every column as i have about 80 in my table. Can't I use an asterisk or something....
View 4 Replies
View Related
Aug 7, 2014
I need to create a stored procedures, this procedure will receive two parameters:
@TableName
@KeyField
I need to storage into a variable the values of ALL THE FIELDS separeted by |
For example if my table is Customers
CustomerID CustomerName City
111 Adventure Boston
222 Pubs NY
And I execute EXEC mysp 'Customers',111
I need a return value like this
@ReturnValue = 111|Adventure|Boston
I create something like this
CREATE PROCEDURE my sp
@table varchar
@key numeric
AS
@field varchar(40),
@object int
Select @object = object_id from systables where name =@table
--The instructions to create a cursor
WHILE (@@FETCH_STATUS = 0 )
Select @object = name from sys.columns where object_id = @object
--The instructions to close and deallocate the cursor
I have alredy to save the value using the EXEC command but is not working; something like
@String = Select @object from @table where CustomerID = @keyValue
View 1 Replies
View Related
Apr 30, 2007
On my aspx page I have a basic sqldatasource and gridview - both were set up using the wizards. The SQL Server 2000 database table that the sqldatasource is querying has some fields in it that are set to not allow nulls, however, the gridview control is not displaying all of the fields in the table - including some of the non-null fields.
My problem is, when I run an insert on the table from my aspx page, I get an error that says: "Cannot insert the value NULL into column 'ColumnName', table 'TableName'; column does not allow nulls. INSERT fails. The statement has been terminated."
The 'ColumnName', as you may have guessed, is one of the aforementioned columns that doesn't allow nulls, but isn't in the GridView.
How can I do an insert on this table without messing with the non-null fields. Those fields are relevant to the purposes of the gridview, so I don't want to display them, let alone allow editing of them.
Any suggestions on my options would be greatly appreciated!
Thanks
Capella07
View 2 Replies
View Related
Apr 13, 2006
Dim strStatus As String
Dim strGroup As String
Dim strLicense As String = dtgPhysician.DataKeys(e.Item.ItemIndex)
Dim strUpdateStatus As String
Dim strUpdateGroup As String
Dim strName As String
Dim strDate As String
Dim strSubject As String
Dim blPDA As Boolean
Dim strPDA As Byte
strStatus = CType(e.Item.FindControl("lstStatus"), DropDownList).SelectedItem.Text
strGroup = CType(e.Item.FindControl("txtGroup"), TextBox).Text
strName = e.Item.Cells(1).Text.Trim
strDate = CType(e.Item.FindControl("txtDate"), TextBox).Text
strSubject = CType(e.Item.FindControl("dpTraining"), DropDownList).SelectedItem.Text
blPDA = CType(e.Item.FindControl("ckPDA"), CheckBox).Checked
strPDA = Convert.ToString(blPDA)
strUpdateStatus = "UPDATE DoctorMaster SET Status = @p_Status , PGroup=@p_Group , @p_PDA wHERE (PLIC= @p_License);"
' ... Make a SQL call to update the database ...
'UpdatePhysician
Dim strConn As String
strConn = ConfigurationSettings.AppSettings("ConString")
If strConn = String.Empty Then
myConn = New SqlConnection()
Else
myConn = New SqlConnection(strConn)
End If
myConn.Open()
Dim daPhysician As New SqlDataAdapter()
Dim comUpdate As New SqlCommand()
comUpdate.Connection = myConn
daPhysician.UpdateCommand = comUpdate
comUpdate.CommandType = CommandType.Text
comUpdate.CommandText = strUpdateStatus
'Return the DataGrid to its pre-editing state
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_Status", System.Data.SqlDbType.Char, 3, "Status")).Value = strStatus
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_Group", System.Data.SqlDbType.NVarChar, 15, "PGroup")).Value = strGroup
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_License", System.Data.SqlDbType.NVarChar, 15, "PLIC")).Value = strLicense
comUpdate.Parameters.Add(New System.Data.SqlClient.SqlParameter("@p_PDA", System.Data.SqlDbType.Bit, "PDA")).Value = CType(e.Item.FindControl("ckPDA"), CheckBox).Checked.ToString
comUpdate.ExecuteNonQuery()
comUpdate.Dispose()
Thanks.
It kept givimg me data format error.
View 1 Replies
View Related
Jul 20, 2005
Just when I though I knew what I was doing. I ran into a roadblock.I have two tables, organizations & usersI am building a form online for orgs to input their own information.How do I insert into both tables when the org table needs to know what theuser_id is, but the user_id hasn't been created until the form is submitted?Any help or request for additional info would be more than great.Thanks!
View 1 Replies
View Related
Dec 6, 2007
Hi folks....
I am able to import a CSV file into a temporary table as long as I know the number of fields in the CSV file. Here is what I would like to do:
I would like to have a CSV file which has UP to 6 entries per row. I would like to insert each row into a table; if the there three fields, then I want to insert them into the first three columns to the temporary table. If there are four, then insert into the first four fields. Is this possible?
Does anyone have any suggestions?
Thanks!
Forch
View 4 Replies
View Related
Jan 15, 2008
Hi all,
I have a projects table with 2 foreign key fields that both link to the same employees table because a project has a Package Engineer (PkgEngineerID) and a Contract Administrator (PkgContrAdmin). When I try to insert a record with null values for either or both of these foreign keys I get an error:
The data in row xxx was not commited. The record can't be added or changed. Referential integrity rules require a related record in table 'tblEmployees'. The transaction ended in the trigger. The batch has been aborted.
An insert statement for the above would look something like the following:
INSERT INTO tblPackages (PkgNo, PkgName, PkgEngineerID, PkgContrAdmin, PkgRemark)VALUES (1234, 'My Package', NULL, NULL, 'My Package remark')
And the create table statements are:
USE [PASSQL]GO/****** Object: Table [dbo].[tblPackages] Script Date: 01/15/2008 23:25:26 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[tblPackages]( [ID] [int] IDENTITY(1,1) NOT NULL, [PkgNo] [nvarchar](20) NULL, [PkgName] [nvarchar](255) NULL, [PkgEngineerID] [int] NULL, [PkgContrAdmin] [int] NULL, [PkgRemark] [nvarchar](255) NULL, [upsize_ts] [timestamp] NULL, CONSTRAINT [aaaaatblPackages_PK] PRIMARY KEY NONCLUSTERED ( [ID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]GOALTER TABLE [dbo].[tblPackages] WITH NOCHECK ADD CONSTRAINT [FK_tblPackages_tblEmployees] FOREIGN KEY([PkgEngineerID])REFERENCES [dbo].[tblEmployees] ([ID])GOALTER TABLE [dbo].[tblPackages] CHECK CONSTRAINT [FK_tblPackages_tblEmployees]GOALTER TABLE [dbo].[tblPackages] WITH NOCHECK ADD CONSTRAINT [FK_tblPackages_tblEmployees1] FOREIGN KEY([PkgContrAdmin])REFERENCES [dbo].[tblEmployees] ([ID])GOALTER TABLE [dbo].[tblPackages] CHECK CONSTRAINT [FK_tblPackages_tblEmployees1]
And:
USE [PASSQL]GO/****** Object: Table [dbo].[tblEmployees] Script Date: 01/15/2008 23:28:01 ******/SET ANSI_NULLS ONGOSET QUOTED_IDENTIFIER ONGOCREATE TABLE [dbo].[tblEmployees]( [ID] [int] IDENTITY(1,1) NOT NULL, [EmpName] [nvarchar](255) NULL, [EmpShort] [nvarchar](255) NULL, [upsize_ts] [timestamp] NULL, CONSTRAINT [aaaaatblEmployees_PK] PRIMARY KEY NONCLUSTERED ( [ID] ASC)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]) ON [PRIMARY]
Any ideas on how to accomplish this would be great!
Thanks in advance!
View 4 Replies
View Related
Aug 3, 2007
Can someone help with this? Let me know if what I'm trying to do is possible...
Here's code example:
@ClientID int,
@QuoteID int,
@Base real,
@One real,
@DwellingLimit real
AS
BEGIN
Insert Into tblOne(ClientID,QuoteID,GuideID,GuideRate,GuideMult,Premium)
Select @ClientID, @QuoteID, GuideID,GuideRate, @+"GuideMult"+,GuideRate*GuideMult
From tblTwo
Where Choose = 'True';
END
I need the value stored in tblTwo.GuideMult (ie. One, BaseRate) to be translated
into the numerical value shown on a webform (ie. @One, @BaseRate) and then
insert the numerical values into tblOne.GuideMult
Clear as mud? Does somebody have a better way to do this?
View 1 Replies
View Related
Apr 20, 2008
need help on update from one table to another like this
this is my first table
tb_all_holiday
id
fname
Start_Date
End_Date
val_holiday
111
aaaa
15/03/2008
21/03/2008
1
222
bbbb
02/05/2008
09/05/2008
3
333
cccc
03/04/2008
15/05/2008
4
333
cccc
29/04/2008
07/07/2008
1
444
dddd
01/05/2008
02/05/2008
1
444
dddd
09/05/2008
19/08/2008
1
555
EEE
09/07/2008
09/08/2008
4
666
fff
10/09/2008
12/09/2008
1
this is my second table to insert into !
i need to insert to another table like this
single row for each day from start_date TO END_DATE
check each employee add row for each day
insert all employee one after one
ID fname new_date val_holiday
----------------------------------------------------
111 aaaa 15/03/2008 1
111 aaaa 16/03/2008 1
111 aaaa 18/03/2008 1
111 aaaa 19/03/2008 1
111 aaaa 20/03/2008 1
111 aaaa 21/03/2008 1
222 bbb 02/05/2008 3
222 bbb 03/05/2008 3
222 bbb 04/05/2008 3
222 bbb 05/05/2008 3
222 bbb 06/05/2008 3
222 bbb 07/05/2008 3
222 bbb 08/05/2008 3
222 bbb 09/05/2008 3
333 ccc 03/04/2008 4
333 ccc 04/04/2008 4
......................................................add row for each day
...............................
333 ccc 15/05/2008 4
TNX for help
View 6 Replies
View Related
Sep 19, 2006
andre writes "I have two questions:
1.)How do i determine if fields are not unique??
2) How to update one table with values from another table when the row names are diffrent??
Thank you!!"
View 1 Replies
View Related
Aug 13, 2007
Dear All,
I have created a table in my SQL server database, the problem i am facing is my insert query fails if i leave any form field empty (leave it blank). On my back-end table, only one field is mandatory, and others have been set with the constraint "allow null".
As per our business requirement, except one value is complusory while others are optional. If I enter all values in the form it works perfectly fine. Can you see in the code below - where am i possibly going wrong ?
<script language="VB" runat="server" > Sub Page_Load(Src As Object, e As EventArgs) If Page.IsPostBack Then Dim ConLath As SqlConnection Dim comLath As SqlCommand Dim insertcmd conLath = New SqlConnection("Data Source=SQLas;Initial Catalog=settle;User ID=sa;Password=password") ConLath.Open() insertcmd = "Insert into His_set values (@t_d,@s_p,@p_s,@v_oq,@i_oq,@v_qn,@i_qn,@v_qw,@i_qw)" comLath = New SqlCommand(insertcmd, ConLath) comLath.Parameters.Add(New SqlParameter("@t_d", SqlDbType.DateTime, 12)) comLath.Parameters("@t_d").Value = trade_date.Text comLath.Parameters.Add(New SqlParameter("@s_p", SqlDbType.Decimal, 8)) comLath.Parameters("@s_p").Value = sett_price.Text comLath.Parameters.Add(New SqlParameter("@p_s", SqlDbType.Decimal, 8)) comLath.Parameters("@p_s").Value = post_close.Text comLath.Parameters.Add(New SqlParameter("@v_oq", SqlDbType.Int, 8)) comLath.Parameters("@v_oq").Value = vol_oq.Text comLath.Parameters.Add(New SqlParameter("@i_oq", SqlDbType.Int, 8)) comLath.Parameters("@i_oq").Value = oi_oq.Text comLath.Parameters.Add(New SqlParameter("@v_qn", SqlDbType.Int, 8)) comLath.Parameters("@v_qn").Value = vol_qn.Text comLath.Parameters.Add(New SqlParameter("@v_qw", SqlDbType.Int, 8)) comLath.Parameters("@v_qw").Value = vol_qw.Text comLath.Parameters.Add(New SqlParameter("@i_qn", SqlDbType.Int, 8)) comLath.Parameters("@i_qn").Value = oi_qn.Text comLath.Parameters.Add(New SqlParameter("@i_qw", SqlDbType.Int, 8)) comLath.Parameters("@i_qw").Value = oi_qw.Text
Try comLath.ExecuteNonQuery() Catch ex As SqlException If ex.Number = 2627 Then Message.InnerHtml = "ERROR: A record already exists with " _ & "the same primary key" Else Message.InnerHtml = "ERROR: Could not add record, please " _ & "ensure the fields are correctly filled out" Message.Style("color") = "red" End If End Try
comLath.Dispose() ConLath.Close() End If End Sub
</script>
View 6 Replies
View Related
Sep 5, 2014
I thought it's easy but somehow got lost, what is the good way to insert that Comma intelligently, depending if any of var value is NULL.
-- DECLARE @var1 varchar(10) = 'alpha1', @var2 varchar(10) = 'bravo2', @var3 varchar(10) = 'charlie3',@var4 varchar(10) = 'delta4'
DECLARE @var1 varchar(10) = 'alpha1', @var2 varchar(10) = NULL, @var3 varchar(10) = 'charlie3',@var4 varchar(10) = 'delta4'
SELECT ss= (CONCAT(@var1, + iif(COALESCE(@var1,@var2,@var3,@var4) IS NULL,'',', '),
@var2, + iif(COALESCE (@var2,@var3,@var4) IS NULL,'',', '),
@var3, + iif(COALESCE( @var3,@var4) IS NULL,'',', '),
@var4) )
View 3 Replies
View Related
Jul 23, 2007
What is the C# code I use to do this?
I'm guessing it should be fairly simple, as there is only one row selected. I just need to pull out a specific field from that row and then insert that value into a different SqlDataSource.
View 7 Replies
View Related
May 29, 2001
Is there any way for me to return the row that was last entered? If so, how do I go about accomplishing this?
For example,
Column1-Plant NameColumn2-Creation DateColumn3-Comments
Bayport 12305/24/01 2:51 AMAirflow became unstable
Bayport 12305/24/01 4:00 AM
Bayport 12305/24/01 5:36 AMNo events
Bayport 12305/24/01 1:00 PM
Bayport 12305/26/01 2:45 PMNo events
Bayport 12305/26/01 3:12 PMStarted liquifier 25% LIN
Bayport 405/24/01 2:51 AMSwung liquifier 0% to LIN
Bayport 405/26/01 5:45 AM
Bayport 405/26/01 5:15 PMLiquifuer @ 25% LIN
Coatesville05/24/01 9:32 AM
Coatesville05/26/01 4:25 PMNo events
If I were to query against 5/26, I would want my result to return as:
Bayport 123 5/26/01 3:12 PM (because this was the last row entered on the 26th) Started liquifier 25% LIN.
Bayport 4 5/26/01 5:15 PM (because this was the last row entered on the 26th) Liquifier @ 35% LIN.
Coatesville 5/26/01 4:25 PM No events.
View 1 Replies
View Related
Jan 28, 2008
I have just started using SQL Server reporting services and am stuck with creating subreports.
I have a added a sub report to the main report. When I right click on the sub report, go to properties -> Parameters, and click on the dropdown for Parameter Value, I see all Sum and Count fields but not the data fields.
For example, In the dropdownlist for the Parameter value, I see Sum(Fields!TASK_ID.Value, "AppTest"), Count(Fields!TASK_NAME.Value, "CammpTest") but not Fields!TASK_NAME.Value, Fields!TASK_ID.Value which are the fields retrieved from the dataset assigned to the subreport.
When I manually change the parameter value to Fields!TASK_ID.Value, and try to preview the report, I get Error: Subreport could not be shown. I have no idea what the underlying issue is but am guessing that it's because the field - Fields!TASK_ID.Value is not in the dropdown but am trying to link the main report and sub report with this field.
Am I missing something here? Any help is appreciated.
Thanks,
Sirisha
View 3 Replies
View Related
Feb 20, 2008
How can I create a Table whose one field will be 'tableid INT IDENTITY(1,1)' and other fields will be the fields from the table "ashu".
can this be possible in SQL Server without explicitly writing the"ashu" table's fields name.
View 8 Replies
View Related
Jan 26, 2008
sir
I have got this error message to establish connction with recordset vb .net, Can you please rectify this
Too many arguments to 'Public Overridable ReadOnly Default Property Fields() As ADODB.Fields'
my code like this
rs = New ADODB.Recordset
rs.Open("Select * from UserLogin where userid='" & txtUserName.Text & "'", gstrDB, DB.CursorTypeEnum.adOpenStatic)
If txtUserName.Text = rs.Fields.Append(userid) Then
MsgBox("OK", MsgBoxStyle.OKOnly, "Confirmation")
End If
thanks
View 1 Replies
View Related
Apr 16, 2001
I am taking a "complete backup" of my production db every day using Backupagent of Arcserver 2000. But the Modified Date of .mdf and .ldf files show an older date. Is it normal?
Thanks
Wilson
View 1 Replies
View Related
Mar 21, 2002
Does anyone know how to get stored procedure or for that matter any other object last modified time?
View 1 Replies
View Related
Jan 14, 2004
Hi all,
Sql server 7
Is there anyway to findout if list of tables that has been modified after august 2003 in a database.
Waiting for ur reply.
TIA
Adil
View 3 Replies
View Related
Nov 26, 2001
Here's an updated version of bigtables.sql that also displays the ratio of index size to data size and the percentage of unused space per table. I've found the index to data ratio particularly helpful for finding and fixing over-indexing.
Cheers
-b
/**************************************************************************************
*
* BigTables.sql
* Bill Graziano (SQLTeam.com)
* graz@sqlteam.com
* v1.11
*
**************************************************************************************/
declare @idint
declare @typecharacter(2)
declare@pagesint
declare @dbname sysname
declare @dbsize dec(15,0)
declare @bytesperpagedec(15,0)
declare @pagesperMBdec(15,0)
create table #spt_space
(
objidint null,
rowsint null,
reserveddec(15) null,
datadec(15) null,
indexpdec(15) null,
unuseddec(15) null
)
set nocount on
-- Create a cursor to loop through the user tables
declare c_tables cursor for
selectid
fromsysobjects
wherextype = 'U'
open c_tables
fetch next from c_tables
into @id
while @@fetch_status = 0
begin
/* Code from sp_spaceused */
insert into #spt_space (objid, reserved)
select objid = @id, sum(reserved)
from sysindexes
where indid in (0, 1, 255)
and id = @id
select @pages = sum(dpages)
from sysindexes
where indid < 2
and id = @id
select @pages = @pages + isnull(sum(used), 0)
from sysindexes
where indid = 255
and id = @id
update #spt_space
set data = @pages
where objid = @id
/* index: sum(used) where indid in (0, 1, 255) - data */
update #spt_space
set indexp = (select sum(used)
from sysindexes
where indid in (0, 1, 255)
and id = @id)
- data
where objid = @id
/* unused: sum(reserved) - sum(used) where indid in (0, 1, 255) */
update #spt_space
set unused = reserved
- (select sum(used)
from sysindexes
where indid in (0, 1, 255)
and id = @id)
where objid = @id
update #spt_space
set rows = i.rows
from sysindexes i
where i.indid < 2
and i.id = @id
and objid = @id
fetch next from c_tables
into @id
end
select top 25
Table_Name = (select left(name,25) from sysobjects where id = objid),
rows = convert(char(11), rows),
reserved_KB = ltrim(str(reserved * d.low / 1024.,15,0) + ' ' + 'KB'),
data_KB = ltrim(str(data * d.low / 1024.,15,0) + ' ' + 'KB'),
index_size_KB = ltrim(str(indexp * d.low / 1024.,15,0) + ' ' + 'KB'),
unused_KB = ltrim(str(unused * d.low / 1024.,15,0) + ' ' + 'KB'),
idx_data_ratio = ltrim(str(indexp*100 /data) + '%'),
unused_pct = ltrim(str(unused * 100 /reserved) + '%')
from #spt_space, master.dbo.spt_values d
where d.number = 1
and d.type = 'E'
order by reserved desc
drop table #spt_space
close c_tables
deallocate c_tables
Edited by graz to add code tags around the code.
View 9 Replies
View Related
Jul 26, 2007
dear friends,
iam new to ssql server.i want to find the modified date of stored procedures. can any one help me in this
View 4 Replies
View Related
Feb 21, 2008
Is there a way to see the last modified date on the Table structure or a stored Procedure in SQL Server 2000?
Thx
View 2 Replies
View Related
Jul 20, 2005
Hello,Is there a way in MSSQL server to find all the objects in the databasebased on the modified date rather than the created date.Thanks in advanceKumu
View 1 Replies
View Related
Jun 13, 2008
All- Supposing I have table_a and table_b. Table_a has fields FIRST_A and LAST_A for people's first and last names. Similarly, table_b has FIRST_B and LAST_B for people's first and last names.
How would I create a record in table_b for each record in table_a, such that for each added record, the values of FIRST_A is copied to FIRST_B and LAST_A is copied to LAST_B. (Table_b will have other fields that are left unfilled.)
Thanks!
-Kurt
View 1 Replies
View Related
Dec 18, 2007
I have stored procedure to show 10 new record from table:SELECT TOP 10 *FROM tableWHERE (id = @id)ORDER BY id DESC and work fine.I'd like to show 10 new record and include modified record as new record. Wo to do that?
View 5 Replies
View Related
Jan 9, 2001
Does anyone know how to get a table's 'last modified date' in SQL 7 ?
Sysobjects contains the 'create date', but I can't find a 'last modified date' anywhere......
View 1 Replies
View Related
Oct 20, 2004
Hi all
My manager ask me to provide him with the total number of records which have been added, deleted or modified on a certain database in SQL Server 2000 during the month of September. Is there away to get that information from the transaction log or by any how?
please some one guide me how to do that?
Your help is highly appreciated
View 8 Replies
View Related
Apr 18, 2005
hi,
I want to find the modified database objects(Tables, Proc and Fun) in last 3 days in SQL 2000.
With Regards
Praveen (DBA)
View 4 Replies
View Related