Do Not Update If There Is No Change In Passed Value

Apr 5, 2008



Hi All,

I have following issue.

Currently, whether values from parameters (there are 20 parameters) passed to one stored procedure will have following script to handle

INSERT INTO log table for all value from TABLEA where ID=@ID

UPDATE TABLEA SET COLUMNA=@COLUMNA and etc,STATUSDATE=getdate() WHERE ID=@ID

However, this creates the problem when the user submit same records, 40 times a day. As a result, statusdate is being updated frequently. This has created the problem in our daily report.

Thus, the user requested to have checking on each column. If any of column has different value, then the update can be done.

what i am thinking at this moment is

BEGIN TRAN

INSERT INTO log table for all value from TABLEA where ID=@ID

INSERT INTO TEMP TABLE (CHANGE_IN_COLUMNA)
UPDATE TABLEA SET COLUMNA=@COLUMNA OUTPUT CASE WHEN DELETED.COLUMNA <> INSERTED.COLUMNA THEN 'YES' ELSE 'NO END and etc,STATUSDATE=getdate() WHERE ID=@ID

IF ANY COLUMN HAS YES VALUE THEN COMMIT TRAN
OTHERWISE ROLLBACK TRAN

Do you think that this is a good solution?

Thanks for the assistance

View 3 Replies


ADVERTISEMENT

Update After A Change

Apr 27, 2008

Hi,

I have two tables (test, test_invoice) both filled in automatically; what i need to do is update whenever there has been a change in table test_invoice (literally new record with date of invoice).

two tables:

create table test
(id_customer int not null
,date1 smalldatetime
,date2 smalldatetime
,flag char(3)
)
ALTER TABLE [dbo].[test] ADD
CONSTRAINT [PK_test] PRIMARY KEY CLUSTERED
(
[id_customer]
) ON [PRIMARY]
GO

insert into test (id_customer, date1, date2, flag) values (2323, '2008-2-23', '', 'Yes')
insert into test (id_customer, date1, date2, flag) values (2325, '2008-2-25', '', 'No')

create table test_invoice
(id_customer int not null
,date_invoice smalldatetime
)

ALTER TABLE [dbo].[test_invoice] ADD
CONSTRAINT [PK_test_invoice] PRIMARY KEY CLUSTERED
(
[id_customer]
) ON [PRIMARY]
GO

insert into test_invoice (id_customer, date_invoice) values (2325, '2008-3-2')
insert into test_invoice (id_customer, date_invoice) values (2329, '2008-3-5')


so how do i make this update happening automatically whenever there is a new record in test_invoice

update t
set t.date2 = ti.date_invoice
from
test as t
inner join test_invoice as ti
on ti.id_customer = t.id_customer


I'd say IF is missing in front of the update sentance...? :-)

Thank you

View 5 Replies View Related

How To Make Update Not Change Case

Apr 15, 2015

This is on the uniqueidentifier column. Both tables are on the same database and have the same COLLATE Latin1_General_CI_AS.

But my plain update and insert results are all upper case.

Then when I tried to force by using

Insert (cols1, cols2) Values (source.col1, source.col2) COLLATE Latin1_General_CI_AS

and

Update set target.col1=source.col1, target.col2=source.col2 target.col1=source.col1 COLLATE Latin1_General_CI_AS

I got

Msg 447, Level 16, State 0, Line 32

Expression type uniqueidentifier is invalid for COLLATE clause.

View 5 Replies View Related

Column Update Structure Change

Feb 8, 2007

hiI want to increase a varchar(5000)to varchar(8000) on a table thathas approximately million rows.....What is the impact on the serveror any good recomendations of a action to accomplish this in the best andfastest way.thanks davep

View 4 Replies View Related

Insert/Update And Delete Change

Sep 2, 2006

hi,

I have a table which contained 5 columns and with 2 primary keys

Col 1 | Col 2 | Col 3 | Col 4 | Col 5 |

ab | 1 | abc | null | null

ab | 2 | def | null | null



Col 1 and Col 2 both are primary keys.



How do I update Col2 from 1 to 2 and from 2 to 1 in a single transaction statement and commit it?

Thanks







View 3 Replies View Related

Is It Possible To Change The Data Type During An Sql Update Statement?

Jun 13, 2007

Hello,



I have a SQL update statement that updates some user names, however, the user names exceed the length of the data type. Currently, for the column username the data type is set to nvarchar (8).



How can I change that to nvarchar(10) in a SQL Update statement?



Thanks in advance.

View 9 Replies View Related

Database Change In Batch Update SQL Script

Oct 31, 2007

I used "OLE DB Command"(row by row) for update but because i found that very very slow i decided to try batch update. I check what is for insert and what is for update and those things that are for update i save to temp table. Then i run this:
update [ODS].[dbo].[Adres]
SET
[MutatieDatumEinde] = stAdres.MutatieDatumEinde,
[StraatNaam] = stAdres.StraatNaam,
[HuisNummer] = stAdres.HuisNummer,
[HuisNummerToevoeging] = stAdres.HuisNummerToevoeging,
[Postkode] = stAdres.Postkode,
[Plaats] = stAdres.Plaats,
[Land] = stAdres.Land,
[IndicatiePTTAdresStandaard] = stAdres.IndicatiePTTAdresStandaard,
[KodeHerkomstAdres] = stAdres.KodeHerkomstAdres,
[VervalDatum] = stAdres.VervalDatum,
[BronODS] = stAdres.BronODS
from
[ODS].[dbo].[Adres] oAdres
inner join [M2O_Stage].[dbo].[ODS_Adres] stAdres
on oAdres.InstNr = stAdres.InstNr and
oAdres.TypeAdres = stAdres.TypeAdres and
oAdres.MutatieDatumAanvang = stAdres.MutatieDatumAanvang
where stAdres.IsInsert = '0'


I run this as an "execute sql task". Everything is running as it should and speed is incomparable, but.. i have problem to make this generic... what i mean is.. db names will change.
How can i make db names dynamic here ?

p.s. i just got idea .. i could probably make dynamic sql statement in script component and then run it there... but does anyone have a better idea ?

View 3 Replies View Related

Make A Copy Of SQL DB And Update/change Stored Procedures

Oct 10, 2006

Can I make a copy of my development database DEV on same SQL SERVER machine, rename it to TEST and stored procedures to be updated automatically for statements likeUPDATE [DEV].[dbo].[Company]SET [company_name] = @company_nameto becomeUPDATE [TEST].[dbo].[Company]SET [company_name] = @company_namein order not to edit each individual stored procedure for updating it ?

View 2 Replies View Related

FullText Change-tracking And Update-index Were Disabled

Jul 30, 2007

How can i enable my fulltex change-tracking and update-index in my table?
I recreated my fulltext catalog and start the full population, but although my fulltext index status shows active, my full-text change-tracking and the update index were disabled. - and I don't know how to enable them.
Thanks in advance

View 3 Replies View Related

Update On Large Table - Change Data Type For Text Column

Dec 10, 2014

I need to update a large table, about 55 million rows, without filling the transaction log, in the shortest time as possible. The goal is to alter the table and change the data type for Text column from VARCHAR(7900) to NVARCHAR(MAX).

Since I cannot do it with an ALTER TABLE statement (it would fill up the transaction log) I'm thinking to:

- rename column Text in Text_OLD
- add Text column of type NVARCHAR(MAX)
- copy values in batches from Text_OLD to Text

The table is defined like:

create table DATATEXT(
rID INTEGER NOT NULL,
sID INTEGER NOT NULL,
pID INTEGER NOT NULL,
cID INTEGER NOT NULL,
err TINYINT NOT NULL,

[Code] ....

I've thought about a stored procedure doing this but how to copy values in batch from Text_OLD to Text.

The code I would start with (doing just this part) is the following, but maybe there are more efficient ways to do it, or at least there's a better way to select @startSeq in the WHILE loop (avoiding to select a bunch of 100000 sequences and later selecting the max).

declare @startSeq timestamp
declare @lastSeq timestamp
select @lastSeq = MAX(sequence) from [DATATEXT] where [Text] is null
select @startSeq = MIN(Sequence) FROM [DATATEXT] where [Text]is null
BEGIN TRANSACTION T1
WHILE @startSeq < @lastSeq

[Code] ....

View 1 Replies View Related

How To Force Deferred Update To Create Two Rows In Change Data Capture

Mar 23, 2015

I have located a bug in the functions cdc.fn_cdc_get_net_changes_<capture_instance> generated when you enable cdc on a table. This bug can be triggered if 2 rows are created in the _CT table having the same values for the __$start_lsn, __$seqval and the table's key column(s). From research on the internet I have found such rows can be created by a "deferred update": a single update statement in which a column that is part of a unique constraint is updated.

In order to report the bug with Microsoft I need to create a complete series of steps-to-reproduce. But even though the situation happens several times a day in our production environment, I have not yet been able to reproduce it in my test environment.I need a single update statement (plus maybe some steps in advance) that make that the log reader inserts 2 rows into the _CT table, one with __$operation = 1 (delete) and another with __$operation = 2 (insert) as opposed to the single row with __$operation = 4 that it inserts for a normal update. Below is the script I have so far to create a fresh database, enable cdc, create a test table, insert some data and update this data.

I would have liked the last update statement to be handled as a "deferred update". However in all of my tests the log reader just simply inserts a single row into the cdc.dbo_NETTEST_CT table.how to reproduce the situation where I get the 2 rows with __$operation 1 and 2 from a single update statement instead of the single row with __$operation = 4.

CREATE DATABASE [cdcnet]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'cdcnet', FILENAME = N'S:SQLDATAcdcnet.mdf' , SIZE = 4096KB , FILEGROWTH = 1024KB )
LOG ON
( NAME = N'cdcnet_log', FILENAME = N'T:SQLLOGcdcnet_log.ldf' , SIZE = 1024KB , FILEGROWTH = 10%)

[code]....

View 4 Replies View Related

T-SQL (SS2K8) :: Change Set Clause Of Update Statement Dynamically Based On Some Condition

May 27, 2015

I want to change Set clause of Update Statement dynamically based on some condition.

Basically i have 2 Update statments having same FROM clause and same JOIN clause.

Only diff is SET clause and 1 Where condition.

So i am trying to combine 2 Update statements into 1 and trying to avoid visit to same table twice.

Update t
Set CASE **WHEN Isnull(td.IsPosted, 0) = 0
THEN t.AODYD = td.ODYD**
*ELSE t.DAODYD = td.ODYD*
END
From #ReportData As t
Join @CIR AS tmp On t.RowId = tmp.Max_RowId

[Code] ....

But CASE statement is not working...

View 7 Replies View Related

View Field Content Update When Real Table Fields Change

Sep 1, 2005

Hi,I use view to join difference table together for some function. However,when the "real" table fields changed (e.g. add/delete/change field). Theview table still use the "old fields".Therefore everytimes when I change the real table, I also needed open theview table and save it by SQL enterprise manager manually for update theview table field.Can we use a SQL command or other method to update it directly?Regards,Silas

View 4 Replies View Related

Edit / Update Query - Change Current Sales Information For A Specific Product

Apr 11, 2012

I am currently working on a website that deals with sales of products. For one of my pages for the website I need it to be able to change the current sales information for a specific product.

The top part of the following code selects the specific product however I cannot get the update query to work.

Code:
$describeQuery = "SELECT p.ID, p.NAME, dt.[Year], dt.[Month], dt.SalesVolume FROM Products p
join
(select ProductCode, sum(SalesVolume) as SalesVolume, [Year], [Month] from MonthlySales
group by ProductCode, [Year], [Month])dt
on dt.ProductCode = p.ID WHERE [NAME] = '$desiredProduct' AND [Year] = '$desiredYear' AND [Month] = '$desiredMonth'";

$editQuery = "UPDATE MonthlySales SET SalesVolume = '$NewSales' WHERE ID = '$desiredProduct' AND Year = '$desiredYear' AND Month = '$desiredMonth'";

$query = sqlsrv_query($link, $describeQuery);

View 3 Replies View Related

SQL Security :: Making Data Change In Read Only Database Without Letting Other Users Update Data

Aug 6, 2015

I want to make data changes in read_only database , that's why i must set database read_write. While database is at read_write mode, i want to be sure that no one makes change in database.

For this aim, i write the code below, but i suspect that after setting the database read_write, till the setting database
single_user ,is it possible get DML script from another user. Is the code below enough for this operation. Or is there another way?

Reminding: Read_only database can not be set single_user mode. That's why, first you must set database read_write.

The code;

use master
alter database xxx set read_write
with rollback immediate
alter database xxx set single_user
with rollback immediate

use xxx
update  tablexxx set columnxxx=yyy
use master
alter database xxx set read_only
with rollback immediate
alter database xxx set multi_user
with rollback immediate

View 5 Replies View Related

I Want To See The Actual SQL Being Passed - How?

Feb 23, 2007

I'm getting a "Input string was not in a correct format." when I'm running a insert statement against my SQL Server 2005 db table.  This helps me zilch as I cant see the actual SQL statement to see which one wasnt right.  Using a SQLDatasource and a Formview btw.
Datasource is called xSqlIB and formview is called fmvIB.
Any ideas?

View 12 Replies View Related

No Date Passed

Aug 18, 2004

I want to update a record that has a datetime field in it. But what if there is no parameter given for that field, i.e. what is the correct type/value to pass as parameter?

Example: A DOB field for a user profile, but the user doesn't enter his birthday

This is some example code that I use to update:

Private Sub UpdateDOB(ByVal dob As Date)

Dim parameters As SqlParameter() = { _
New SqlParameter("@Birthday", SqlDbType.DateTime, 8)}

parameters(0).Value = dob

'Run Stored Procedure

This gives me the exception "SqlDateTime overflow. Must be between 1/1/1753 12:00:00 AM and 12/31/9999 11:59:59 PM" when I don't pass a valid date. I tried passing Nothing but same error (in this case it convert dob to "#12:00:00 AM#")

The only thing I can think of is to use Date.MaxValue and then check in application logic, but there must be a better way!

View 5 Replies View Related

Passed My 70-228 Exam!

Dec 27, 2005

finally on the road to becoming a full blown ass kicking mcdba!

passed it before christmas with the help of my girlfriend.

brilliant or what!

failed it last time back in 2004


all the best and have a cracking 2006 all!

View 3 Replies View Related

Db Passed As Param To Sp

Mar 12, 2008

is there a way in t-sql to pass a db name as a parameter, so that select * from [@passedDB].[dbo].[tableName] would work? Without dynamically building and executing the sql statement?

View 1 Replies View Related

Formatting Values Being Passed To Sql

Nov 3, 2004

I have a generic page with some fields on it, I would like to be able to "groom" the values so that the data is nice and consistent.

Example: input 1 -- user types in "bob" or "BOB" or "Bob" or "JOE" etc....

the resulting record in Sql would be "Bob", "Fred", "Joe"
nice and formted out.

Any suggestions?

View 1 Replies View Related

Make Use Of An Passed XML Parameter

Nov 19, 2007

I have tested the following code, and it works for me:

DECLARE @XML XML
SET @XML = '
<DocumentElement>
<data>
<item code="ABCDEFG" quantity="1" sort="0" />
<item code="XCFVGBF" quantity="1" sort="0" />
<item code="ABCDEFG" quantity="10" sort="0" />
</data>
</DocumentElement>'

SELECT SUM(x.qty * ISNULL(p.price_mn,0))
FROM (SELECT [Code] = A.A.value('@code','varchar(20)'),
[Qty] = A.A.value('@quantity','INT')
FROM @xml.nodes('/DocumentElement/data/item') AS A(A)) X
LEFT JOIN productprice_t P ON p.code_id = x.code


The question is, how can I do this if the XML is in a different format & doesn't use any attributes?
So it looks like this (which I'm getting from an ADO.Net datatable using .WriteXML):
<DocumentElement>
<data>
<code>ABCDEFG</mercurycode>
<quantity>1</quantity>
<sort>0</sort>
</data>
<data>
<mercurycode>XCDFEG</mercurycode>
<quantity>2</quantity>
<sort>0</sort>
</data>
<data>
<code>ABCDEFG</mercurycode>
<quantity>10</quantity>
<sort>0</sort>
</data>
</DocumentElement>

View 5 Replies View Related

BETWEEN Predicate With Passed Parameters

Apr 14, 2004

I have a report in SQL that passes parameters at runtime entered by the user for two date ranges (beginning and ending). I'm trying to write a formula that will print a specific field *only if* the specified date range entered by the user is BETWEEN a specific value (like 200401). This is kind of reverse of a normal WHERE, BETWEEN clause.

I tried a standard BETWEEN predicate in my WHERE clause like:
IF '200401' BETWEEN ?BegPer and ?EndPer then salesanal.ptdbud01 else 0

But, it's returning an error that my Then statement is missing. I can't use a normal statement like 'IF ?BegPer >= '200401' and ?EndPer <= '200401', then.....' because users could enter a RANGE of periods, so it would be difficult to code all of the possible combinations this way. I'm actually doing this in Crystal, but if someone can give me a standard MSSQL example, I can translate that over to Crystal.

Thanks in advance,
Michelle

View 4 Replies View Related

Parameter Value Not Being Passed For My SProc

Mar 19, 2007

I am quite new to SSRS and am having some difficulties in trying to develop a new report via Business Intelligence Studio based on a stored procedure which requires the input of 1 parameter, and also has an optional parameter which I default to NULL in the sproc.

When I create my dataset I select the given sproc I want and when I attempt to execute it, I am prompted for the parameters the sproc expects.

However, when I enter a value in the dialog for the required Parameter I get a SQL error indicating that the parameter the sproc expects was not supplied. I have profiled the call and see the attempt to execute the sproc, but no parameter value.

Can some one tell me why the value I enter is not being passed to the sproc in my database ? Is there some special syntax that I need to use ?

I have scanned a number of sites & through the books I have and can't find anything on this. From what I have read, when I exec my sproc the parameters get recongnized & I can just enter my values. This doesn't seem to be the case.

Any help and/or suggestions are appreciated !!!
Thanks.

View 8 Replies View Related

Getting The Parameter Value Passed From Url String

Nov 30, 2007

I have a requirement where, I need to get the value of parameter from a query string of url and use it in my report.
Ex:- http://www.mysite.com?name=bobby

From the above url, I have to take the value of name and be able to use it in my report query or assign to a parameter.

Please let me know, how can I acheive this.

View 1 Replies View Related

Can Rs Be Passed Db Source Name At Run Time?

Mar 11, 2008

we remount archives in special situations to one or more databases.

We'd like our embedded RS reports to be flexible enough to learn at run time which database to use as a source. Are there ways to do this in 2005, 2000 or both?

View 1 Replies View Related

Can A Passed Parameter Be A Check Box?

Jan 28, 2008

I have a boolean parameter on my report that the user will enter. Currently, it shows as an option button with True/False beside each option as the words used. Is it possible to have a check box instead of an option button for the user instead?
Thanks in advance!

View 3 Replies View Related

SQL Datasource Passed To Query String?

Aug 8, 2006

I have been attempting to build a search engine that searches a database full of invoices. The user will enter in a invoice number and then the results will be returned if the exact invoice exists and if the record belongs to the user.
My first attempt has involved the use of a SQL Datasource to pass a stored procedure based on what is in the search textbox and the information in the cookie about the user.  I was hoping that on the btnsearch.click event that I could somehow return the stored procedure in the SQL DataSource. My next step was to make the result (if exists) part of the query string like this:
Response.Redirect("~/Invoice.aspx?Invoice=?"+ SQLRETURNEDVALUE)
 
I'm looking for any help to a possible way to use my idea or any other ideas to get a invoice number and place it into a query string so that the result can be fetched on the next page. Thanks

View 4 Replies View Related

List Of Strings Passed Into A Parameter

Oct 18, 2006

I am trying to pass multiple values as parameters into my update command:UPDATE tblUserDetails SET DeploymentNameID = 102 WHERE ((EmployeeNumber IN (@selectedusersparam)));I develop my parameter (@selectedusersparam) using the following subroutine: Private Sub btnAddUsersToDeployment_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnAddUsersToDeployment.ClickDim iVal As Integer = 0Dim SelectedCollection As StringSelectedCollection = ""If (lsbUsersAvail.Items).Count > 1 ThenFor iVal = 0 To lsbUsersAvail.Items.Count - 1If lsbUsersAvail.Items(iVal).Selected = True ThenSelectedCollection = SelectedCollection & "," & lsbUsersAvail.Items(iVal).ValueEnd IfNextSelectedCollection = Mid(SelectedCollection, 2, Len(SelectedCollection))Session.Item("SelectedCollectionSession") = SelectedCollectionSqlDataSource4.Update()ltlUsersMessage.Text = String.Empty 'UPDATE tblUserDetails SET DeploymentNameID = @DeploymentNameIDparam WHERE (EmployeeNumber IN (@selectedusersparam))'SqlDataSource4.UpdateCommand = "UPDATE tblUserDetails SET DeploymentNameID = @DeploymentNameIDparam WHERE (EmployeeNumber IN (" + SelectedCollection + ")"ElseltlUsersMessage.Text = "Select users before adding to deployment. Hold Control for multiselect"End IfEnd SubFor some reason the query does not pass the parameters which are "21077679,22648722,22652940,21080617" into the queryI don't understand why.

View 4 Replies View Related

Using Passed Parameters In A Select Statement

Aug 21, 2007

hello all, im trying to run a select statement using a parameter, but am having extreme difficulties. I have tried this about 50 different ways but i will only post the most recent cause i think that im the closest now than ever before ! i would love any help i can get !!!
 Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)
Dim pageID As StringpageID = Request.QueryString("ID")
TextBox13.Text = pageID 'Test to make sure the value was stored
SqlDataSource1.SelectParameters.Add("@pageID", pageID)
End Sub
.... 
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ProviderName=System.Data.SqlClient ConnectionString="Data Source=.SQLEXPRESS;Initial Catalog=software;Integrated Security=True;User=something;Password=something" 'SelectCommand="SELECT * FROM Table1 WHERE [ClientID]='@pageID' ></asp:SqlDataSource>
 
The error that i am getting, regardless of what i put inside the ' ' is as follows:
"Conversion failed when converting the varchar value '@pageID' to data type int."
 
anyone have any suggestions ?
 

View 2 Replies View Related

What Value Needs To Be Passed To Parameter In WHERE To Negate The Filtering

Apr 9, 2008

I am using two drop downs, like so:
<asp:DropDownList ID="ChurchStateDrop" runat="server"                              DataSourceID="ChurchStateDropData" DataTextField="State"                              DataValueField="State" AutoPostBack="True"                              onselectedindexchanged="ChurchStateDrop_SelectedIndexChanged"                             AppendDataBoundItems="True">        <asp:ListItem Value="?????" Selected="True" Text="All States" /></asp:DropDownList>
<asp:DropDownList ID="ChurchCityDrop" runat="server"                             DataSourceID="ChurchCityDropData" DataTextField="City"                              DataValueField="City" AutoPostBack="True"                             onselectedindexchanged="ChurchCityDrop_SelectedIndexChanged"                             AppendDataBoundItems="True">        <asp:ListItem Value="?????" Selected="True"  Text="All Cities" /></asp:DropDownList>
I have ????? in the value fields because I don't know what value needs to be passed to negate filtering (to choose all). The Dropdowns have the following SQLDatasources:<asp:SqlDataSource ID="ChurchStateDropData" runat="server"                               ConnectionString="<%$ ConnectionStrings:tceDatabaseOnlineSQLConnection %>"                                SelectCommand="SELECT DISTINCT                                                                        [State]                                                             FROM [ChurchView]"                               DataSourceMode="DataReader"></asp:SqlDataSource>
<asp:SqlDataSource ID="ChurchCityDropData" runat="server"                                ConnectionString="<%$ ConnectionStrings:tceDatabaseOnlineSQLConnection %>"                               SelectCommand="SELECT DISTINCT                                                                        [City]                                                             FROM [ChurchView]                                                          WHERE ([State] = @State)"                               DataSourceMode="DataReader">                               <SelectParameters>                                 <asp:ControlParameter ControlID="ChurchStateDrop"                                                                   Name="State" PropertyName="SelectedValue" Type="String" />                               </SelectParameters></asp:SqlDataSource>
Now, lets say I wanted to pass a value to the WHERE statement in ChurchCityDropData to coincide with 'All States', what would I replace value="??????" with? Now you may think I'm crazy to do such a thing, but this actually has to do with adding a Denomination Dropdown to show Denominations from all states or all cities. I will figure out the best logic for that later, I just want to know the wildcard to pass to the parameter to choose all states (negate filtering).

View 3 Replies View Related

Viewing Sql String Passed Into Sql Server

Mar 8, 2004

I have a stored proc that has several parameters. (using SQL server)

i call this proc and add the parameters etc and execute it etc

the problem is that how can i see the string that is being passed to the db? eg the calling command?


cheers

View 2 Replies View Related

Returning All Fields From Any Table Name Passed .

Nov 30, 1998

I am trying to created a stored procedure/query to return all fields from any of my 43 look-up tables in my database. I have all of my look-up table names listed in a VB grid. I want the user to select a particular table, click edit (which pass's the table name) and have one stored procdure return all of the field in the table and populate them in a second VB form with the fields listed in a new grid.


Can one pass the "SQL string" to excute/ create a temp table.... A regular SP requires a specife table name to query from. Is there a way to do this without creating a temp table

Thanks for the help
EM.

View 2 Replies View Related

T-SQL (SS2K8) :: Select If Null Passed Else By INT

May 14, 2014

I'd like to be able to offer the option of selecting a project by the ProjectID number, and if a projectID is not supplied then the default result set would be select * from tbl_Projects.

ALTER PROCEDURE [USP_SelectProject]
-- Add the parameters for the stored procedure here
@ProjectNumber as int
AS
BEGIN

[code]....

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved