Remote Webwork Place

Dec 11, 2006

We have a SBS2003 server. And configured remote workplace to allow remote users

access to their workstion. On the windows XP Pro sp2 station I have added the user to the "Remote desktop" list ( control panel-system-remote-allow users to remotely connect this computer - Add .)

Nomal users can pass router and select wanted station then get logon screen. But this error message is showed up:

"The local policy of this system does not permit you to logon interractively."

The administrator can logon to any station remotely. Do I have to give additional permission to normal user?

Thank you for any help or clue.



Peter

View 4 Replies


ADVERTISEMENT

Is There A Place Where I Can Find The Events That Takes Place In Sql Server?

Jul 20, 2007

Is there a place where i can find events that takes place in the sql server? Like adding data to a database or something like that....



Regards

Karen

View 4 Replies View Related

Best Place To Put TempDB

Nov 16, 2001

Hi,

Can anyone give me any input on this. Recently TempDB one of my production server came down because tempDB got so big that it chewed up all the space in it's drive. My TempDB was in drive C:, where the Operating system and the rest of the SQL systems databases are(msdb,model,master). The actual production data are located in another logical RAID 5(Drive E:) Drive. I want to prevent the problem from happening again. Is it wise or does it degrade performance if i move TEMPDB from drive C: to drive E:? Is this going to cause a major bottom neck in drive E:, where the data are located?

Thank You for any help!


Eric

View 1 Replies View Related

Sql Box Moved From One Place To Other

Jan 5, 2006

what happens if the physical location of a box(which had sql server 2000 on it) is chaned.
what happens to the replication and distributed queries.
Thanks.

View 1 Replies View Related

No Place On Disk

May 20, 2004

I have one big db and i heve no place on disk
the log file is big too. how can i delete the log

View 7 Replies View Related

Best Place To Start

Apr 17, 2007

I am fairly versed with SQL 2005 as I have been using it since it came out. Now I have need to learn about Cubes.



Does anybody have any suggestions of where I need to begin to learn about what cubes are, how to create them and use them?



Ultimately we will be incorporating them into Reporting Services.



Thanks for the information.

View 3 Replies View Related

Where To Place An Order By

Dec 26, 2007

Where would i place an orderby my DateCreated field...everywhere i try to place it i get this error...
The ORDER BY clause is invalid in views, inline functions, derived tables, subqueries, and common table expressions, unless TOP or FOR XML is also specified. Any help with this issue would be greatly appreciated....



CREATE PROCEDURE GetTimeCard

( @LoginID nvarchar(50),

@DateRangeFrom datetime,

@DateRangeTo datetime

)

AS

BEGIN

IF ( @DateRangeFrom = '1/1/1753' ) AND ( @DateRangeTo = '1/1/1753' )

select x.*, x1.TotalExpenses, x2.WorkedCount

from (

select tc.TimeCardID, tc.DateCreated,tc.DateEntered, oe.FirstName, oe.LastName

from OPS_TimeCards tc

join OPS_TimeCardExpenses tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID

group by tc.TimeCardID, tc.DateCreated,tc.DateEntered, oe.FirstName, oe.LastName



union

select tc.TimeCardID, tc.DateCreated,tc.DateEntered,oe.FirstName, oe.LastName

from OPS_TimeCards tc

join OPS_TimeCardHours tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID

group by tc.TimeCardID, tc.DateCreated ,oe.FirstName,tc.DateEntered, oe.LastName ) x

left outer join (

select tc.TimeCardID, tc.DateCreated,tc.DateEntered, sum(tce.ExpenseAmount) as TotalExpenses

from OPS_TimeCards tc

join OPS_TimeCardExpenses tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID

group by tc.TimeCardID, tc.DateCreated,tc.DateEntered ) x1 on x1.TimeCardID = x.TimeCardID and x1.DateCreated = x.DateCreated and x1.DateEntered = x.DateEntered

left outer join (

select tc.TimeCardID, tc.DateCreated,tc.DateEntered, count(*) WorkedCount

from OPS_TimeCards tc

join OPS_TimeCardHours tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID

group by tc.TimeCardID, tc.DateCreated, tc.DateEntered) x2 on x2.TimeCardID = x.TimeCardID and x2.DateCreated = x.DateCreated and x2.DateEntered = x.DateEntered



ELSE



select x.*, x1.TotalExpenses, x2.WorkedCount

from (

select tc.TimeCardID, tc.DateCreated,tc.DateEntered, oe.FirstName, oe.LastName

from OPS_TimeCards tc

join OPS_TimeCardExpenses tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID And tc.DateCreated BETWEEN @DateRangeFrom AND @DateRangeTo

group by tc.TimeCardID, tc.DateCreated,tc.DateEntered, oe.FirstName, oe.LastName



union

select tc.TimeCardID, tc.DateCreated,tc.DateEntered,oe.FirstName, oe.LastName

from OPS_TimeCards tc

join OPS_TimeCardHours tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID And tc.DateCreated BETWEEN @DateRangeFrom AND @DateRangeTo

group by tc.TimeCardID, tc.DateCreated ,oe.FirstName,tc.DateEntered, oe.LastName ) x

left outer join (

select tc.TimeCardID, tc.DateCreated,tc.DateEntered, sum(tce.ExpenseAmount) as TotalExpenses

from OPS_TimeCards tc

join OPS_TimeCardExpenses tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID

group by tc.TimeCardID, tc.DateCreated,tc.DateEntered ) x1 on x1.TimeCardID = x.TimeCardID and x1.DateCreated = x.DateCreated and x1.DateEntered = x.DateEntered

left outer join (

select tc.TimeCardID, tc.DateCreated,tc.DateEntered, count(*) WorkedCount

from OPS_TimeCards tc

join OPS_TimeCardHours tce on tc.TimeCardID = tce.TimeCardID

join OPS_Employees oe on oe.EmployeeID = tc.EmployeeID

where oe.LoginID = @LoginID

group by tc.TimeCardID, tc.DateCreated, tc.DateEntered) x2 on x2.TimeCardID = x.TimeCardID and x2.DateCreated = x.DateCreated and x2.DateEntered = x.DateEntered

End

GO

View 3 Replies View Related

Where To Place Articles

May 30, 2006

I have a design that includes articles that will be searched. Obviously its too slow to put them into fields, and impossible because some have photos or are otherwise html documents. So I want to put pointers to their location.

Two questions. For each deployment, both desktop and web, where is the best place to put the articles. In any folder, or only in an iis virtual folder?

dennist685

View 5 Replies View Related

SQL Servers Place In The 'Application'

Jan 28, 2004

I'm rapidly understanding that much more of my application as a whole is in SQL Server that I would have originally thought.

Stored Procedures
Triggers
Constrains
And so on

It generally means that some of the stuff I'd have naturally done in the Business Layer might be best done in SQL - certain issues in the Business Layer might be best being triggers or constraints for example...

One thing that still puzzles me, and I'd like some references or advice now as it's a blank area in my mind is how this interfaces to your asp.net code.

Obviously I call stored procedures and the like from code, and use parameters, etc, not problem, it's more what I do when these stored procedures or associated triggers fail (or a constrain fails - though this should be less likely)?

SQL sends back an error? But what? Then what do you get your page to do, especially if SQL failed midway through a 'big' transaction? Do you have save 'where the user was somehow' so they don't start inputting again?

It's all a bit vague at the moment, some detail would be nice? :)

View 4 Replies View Related

SQL Query Needs Decimal Place

Nov 12, 2005

Hello all,I have an SQL query which retrieves a COUNT number from 2 different tables, and i want to do a division with botht he COUNT data retrieved. Trouble is I can't get it in the format that I want, my SQL query is as below :-SELECT ROUND( ((T1.Present/T2.Total ) * 100), 2) FROM(Select Count(Date) as Present from Attendance WHERE Month(Date)=12 AND Status=1) T1,(Select Count(Date) as Total from Attendance WHERE Month(Date)=12) T2The trouble here is that the result should be as below: T1.Present = 3T2.Total = 5  T1.Present/T2.Total = 3/5 = 0.6The final should be 60 after divided by 100But i am getting a zero as my result, even when I don't multiply the number by 100, the division result is still zero. I am guessing it is a conversion problem. Could anyone please offer me any advise on how to get the final result in the format I want?

View 2 Replies View Related

Place Index On Filegroup

Dec 14, 2001

Hi, I want to replace the indexes in my database to a different
filegroup. How can I do that using T-SQL? I only found a way that
uses the EM, but I have a lot of indexes and I hate to do it manually.

Thanks a lot.

View 2 Replies View Related

Null Error In One Place, But Not The Next

Aug 9, 2001

One of our customers has a production and a test database. We are loading tables via a C++ program that works on production, but not on test, which is supposed to be an exact duplicate.

The error we are getting when trying to add columns to one of the table is 80004e21 null That is it.

When we load the exact same records in the production environment we do not get the error. We have spent many hours ensuring that the tables are exactly the same on test as in production.

Does anyone know, is there an environment variable at a database level that says how to handle null values?

Thanks!!!
C

View 1 Replies View Related

Upgrading From SQL 6.5 To 7.0 With Replication In Place.

Feb 4, 2000

If I have a publisher, distributor, and subscribers all running SQL 6.5, and I wish to upgrade to SQL 7.0, in what order to I upgrade?

View 1 Replies View Related

Database Backup To Different Place

Mar 11, 2004

Hi All!

I know that if is want to backup my db on the c: drive i do this
BACKUP DATABASE DBName
TO DISK = 'c:isl_fs1DBName.bak'

BUT HOW do I take this to the network. I tried
BACKUP DATABASE DBName
TO DISK = '\isl_fs1DBName.bak'
it doesn't work please help

View 2 Replies View Related

Can You Use A VARIABLE In Place Of A Database Name?

Apr 8, 1999

Does anyone know if it is possible to use a variable in place of a database..table combination in a select statement

For Example: Instead of using the following with each database hardcoded in the SP:

select @dataused = sum(b.reserved)
from DBSglep..sysindexes b
where b.indid in (0, 1, 255) and segment != 2

I would like to loop for every database listed in sysdatabases and do this:

select @dbname = @dataname+'..sysindexes'

select @dataused = sum(b.reserved
from @dbname b
where b.indid in (0, 1, 255) and segment != 2

I have got the loop working, but just can't get the name substitution working as MSSQL dosn't seem to allow a variable after the FROM statement (it only seems to work with a hardcoded specific database..table name).

Any assistance in resolving this problem would be greatly appreciated! :-)

Many thanks in advance...

Regards,
Wayne

View 2 Replies View Related

Best Place To Look For Memory Leak

Jun 21, 2001

Last 2 nights (at night) my SQL Server has locked up, first night trying to back up MSDB(20 meg) and last night ran out of memory at 6:30 AM. No users on at either time, no jobs running on the second night. I was going to turn perfmon on tonite. Any input on what best to monitor?

View 2 Replies View Related

Log Shring When No Place On The Disk ?

Nov 28, 2007

Hello,I run out of space on the disk, my db log is 130GB, I need to shrink db log. I made a backup through network by UNC of the database, but when I want to backup log, I get a message :BACKUP LOG cannot be performed because there is no current database backup.But the backup is reachable, I can restore from it.Any ideas ?

View 8 Replies View Related

Proper Place For Sub Select?

Feb 14, 2013

I have a very simple query that gets a field to use as constraints in another query.

Code:

SELECT A.RIN
FROM apcType T
INNER JOIN apcAttribute a on A.T = T.RIN
WHERE T.Name like '%Sales'

The results of the first query are used in the following query where it is bolded and marked with and <<<<========

Code:
SELECT AP.Arg2, AP.Arg3, M.Parcel,
M.Serial, M.Name, M.Acres, M.District,
V.YearBuilt, V.Code, V.Size,
(SELECT SUM(V1.Acres)
FROM TRValue V1
WHERE V1.Year = V.Year and V1.Parcel = V.Parcel and
SUBSTRING(V1.Code, 1, 1) = 'L'

[code]....

My question is How can I fold the first query into the second?

View 1 Replies View Related

Stored Procedure In Place Of UDF?

Jan 7, 2004

thanks for reading.

i'm wondering if i can use a stored procedure in place of a UDF in the case where i want a return value based on a simple calculation involving the input parameter.

i'd like to use this inline in a query somewhere else. that's why the UDF.

the UDF would be something like this ...

create function getFiscalYear (@when datetime)
returns int
as
BEGIN
declare @rv int

-- months of Oct, Nov, Dec are rolled into following year
if datepart(month, @when) >= 10
select @rv = datepart(year, @when) + 1

-- whereas all other months stay in this year
else
select @rv = datepart(year, @when)
end

END

so, the only reason i'm not using this UDF (and haven't tested it either) is because i can't find (or can't remember how :( ) to add a UDF to my database. when i run this code in Query Analyzer i get an error on the keyword "function". but that's another question altogether.

thanks in advance. (a) for helping with a stored procedure that does the equivalent or (b) nudging me in the right direction towards getting UDFs to work in my SQL 2000 install.

View 5 Replies View Related

Backup Database At Different Place

Mar 11, 2004

Hi All!

I know that if is want to backup my db on the c: drive i do this
BACKUP DATABASE DBName
TO DISK = 'c:isl_fs1DBName.bak'

BUT HOW do I take this to the network. I tried
BACKUP DATABASE DBName
TO DISK = '\isl_fs1DBName.bak'
it doesn't work please help

View 2 Replies View Related

Find A Record Out Of Place

Oct 15, 2013

I have a table called Register that has the following in it

Policy_number, Policy_date_time, Portfolio_set, Status..The rule for the table is that the last record for each portfolio_set for a policy the status needs to be 'A' but there have been instances that the last record status is 'I'

I need to identify the record that is out of place..In the example below record number 2.

example

policy_number Policy_date_time Portfolio_set, status
12345 1/1/2011 1 I
12345 1/2/2011 1 A
12345 1/3/2011 1 I
12345 1/4/2011 1 I

I need to identify that the second record is in the wrong place...

View 4 Replies View Related

How To Use A Parameter In Place Of A Literal?

Oct 5, 2007

I have a stored procedure that starts like this:

.
.
.
UPDATE Employees
set depth=0, hierarchy=NULL

UPDATE Employees
set depth=1, hierarchy=right(@MaxPadLength + CAST(Employees.Parent AS varchar(255)),@DisplayPadLength)
where Child = Parent

WHILE EXISTS
(
SELECT *
FROM Employees
WHERE Depth=0
)
.
.
.
I have many tables that have the same structure as the Employees table but have different names. I would like to pass the PS a paramater with the table name I want to process. My question is what is the correct syntax to use a parameter in place of the literals for the table name?

Thanks

View 4 Replies View Related

Insert A Record In A Particular Place

May 27, 2006

i have a table name is HH tableit has two columns 'hhno' and hhname'HH tabelehhno hhname100 suresh101 baba103 rami want to insert a one record(102 , chandra) in HH table between(101,baba) and( 103 ,ram).how can i insert them please help ,me thanks

View 10 Replies View Related

Sorry For The Low Skill Qustion, Maybe It's Not The Right Place

Sep 28, 2007



How am I configuring permission for an SQL database, that user within my program should'nt read private information?

as well how can I protect my database with a UN & PWD to allow access only for authenticated users, not within the program, just the *.mdf file?

View 7 Replies View Related

In-Place Upgrade Query

May 10, 2007

Hi,

While we choose in-place upgrade for upgrading to SQL Server 2005 from SQL Server 2000, does it actually change the code in Stored Procedures/functions also?



e.g. if I have *= in some old procedure does it change it to INNER JOIN while migrating?



Please help me on this ASAP.



Regards,

Rahul

View 1 Replies View Related

How To Know Allocation Place For Each Object?

May 25, 2007

Hi all of you,



My current dutie is try to obtain for each table their filegroup.



I'm seeing sysobjects table but I can't see nothing related to do with



Thanks a lot for your time,



View 4 Replies View Related

Newbie Needs Place To Start

May 29, 2007

I am totally new to the BI world. I was just wondering where I should start to begin setting up a BI solution. I started trying to go through the Microsoft Anaylsis Services tutorial line for line in the MSDN website. I couldn't get the sample solution to work quite right. Should I be starting somewhere more simple to start. Please help, so far it looks a bit overwelming, especially with the terminology and examples I have seen so far from various sites about BI and Data Mining.

View 1 Replies View Related

How To Sum The Time And Place At The Last Registry

Aug 2, 2007

Hi,

I have the following problem... In my table I store calling registries...and when a call is transfered to another branch the last brach have to receive all the time...
Só I have the following table




Code Snippet
CREATE TABLE [BILHETES_PROCESSAR] (
[COD_CLIENT] [varchar] (50) COLLATE Latin1_General_CI_AS NOT NULL ,
[DATE_TIME] [datetime] NOT NULL ,
[NRTELEFONE] [varchar] (255) COLLATE Latin1_General_CI_AS NOT NULL ,
[BRANCH] [varchar] (255) COLLATE Latin1_General_CI_AS NULL ,
[TIPO] [varchar] (255) COLLATE Latin1_General_CI_AS NULL ,
[TIPO_ORIGINAL] [varchar] (255) COLLATE Latin1_General_CI_AS NULL ,-- Tells if is a originate call "2" or received a tranfer "6"
[TRONCO] [varchar] (255) COLLATE Latin1_General_CI_AS NULL , -- The port of the router through the call have been made
[TRANSF] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,--The branch that is going to receive this call
[ORIGEM_TRANSF] [varchar] (50) COLLATE Latin1_General_CI_AS NULL ,--The branch that sent the call
[VALOR_TEMPO] [money] NULL ,
[ID_TRANSF] [uniqueidentifier] NULL ,--ID for the branch that originated the call
[ID_REGISTRO] [uniqueidentifier] NOT NULL --ID of the registry
) ON [PRIMARY]
GO



For this table I can have the following data



Code Snippet1002 2007-07-30 17:52:34.000 01191084426 236 2 2 9 210 NULL 15.0 C1AF0190-B1EB-4DEB-993A-D64D6C9F7CD4 C1AF0190-B1EB-4DEB-993A-D64D6C9F7CD4
1002 2007-07-30 17:53:17.000 01191084426 210 2 6 9 214 236 63.0 C1AF0190-B1EB-4DEB-993A-D64D6C9F7CD4 D680C38D-C217-461A-8207-9FC367FBB51C
1002 2007-07-30 17:54:30.000 01191084426 214 2 6 9 NULL 210 50.0 C1AF0190-B1EB-4DEB-993A-D64D6C9F7CD4 24B3073B-F45F-4E87-9796-55F37847473D


So I got this results running this query..



Code Snippet

UPDATE P SET P.TRANSF=P2.BRANCH,
P.ID_TRANSF=
CASE
WHEN P.TIPO_ORIGINAL = '2' THEN P.ID_REGISTRO
WHEN P2.ID_TRANSF IS NOT NULL THEN P2.ID_TRANSF
ELSE '1C4CCB4E-9229-4A6C-A6A4-B881A01EEACF'
END
FROM BILHETES_PROCESSAR P INNER JOIN BILHETES_PROCESSAR P2
ON
P.COD_CLIENTE=P2.COD_CLIENTE AND
P.NRTELEFONE=P2.NRTELEFONE AND
P.TRONCO=P2.TRONCO
WHERE
P2.DATE_TIME >= P.DATE_TIME
AND (
(P.TIPO_ORIGINAL IN (1, 5, 7) AND P2.TIPO_ORIGINAL IN (5, 7)) OR
(P.TIPO_ORIGINAL IN (2, 4, 6, 8) AND P2.TIPO_ORIGINAL IN (4, 6, 8))
)
AND P2.BRANCH <> P.BRANCH
AND P.TRANSF IS NULL

UPDATE P2 SET P2.ORIGEM_TRANSF=P.BRANCH, P2.ID_TRANSF=
CASE
WHEN P.ID_TRANSF IS NOT NULL THEN P.ID_TRANSF
ELSE P.ID_REGISTRO
END
FROM BILHETES_PROCESSAR P INNER JOIN BILHETES_PROCESSAR P2
ON
P.COD_CLIENTE=P2.COD_CLIENTE AND
P.NRTELEFONE=P2.NRTELEFONE AND
P.TRONCO=P2.TRONCO
WHERE
P2.DATE_TIME >= P.DATE_TIME
AND (
(P.TIPO_ORIGINAL IN (1, 5, 7) AND P2.TIPO_ORIGINAL IN (5, 7)) OR
(P.TIPO_ORIGINAL IN (2, 4, 6, 8) AND P2.TIPO_ORIGINAL IN (4, 6, 8))
)
AND P2.BRANCH <> P.BRANCH
AND P2.ORIGEM_TRANSF IS NULL

UPDATE P2 SET P2.ID_TRANSF=P.ID_TRANSF
FROM BILHETES_PROCESSAR P INNER JOIN BILHETES_PROCESSAR P2
ON
P.COD_CLIENTE=P2.COD_CLIENTE AND
P.NRTELEFONE=P2.NRTELEFONE AND
P.TRONCO=P2.TRONCO
WHERE
P2.DATE_TIME >= P.DATE_TIME
AND (
(P.TIPO_ORIGINAL IN (5, 7) AND P2.TIPO_ORIGINAL IN (5, 7)) OR
(P.TIPO_ORIGINAL IN (4, 6, 8) AND P2.TIPO_ORIGINAL IN (4, 6, 8))
)
AND P2.BRANCH <> P.BRANCH
AND P2.ID_TRANSF='1C4CCB4E-9229-4A6C-A6A4-B881A01EEACF'










This query has only one problem if the user has made a 4º transfer th2 two last registry will have wrong "transf" and "origem_transf" values... but this is not my big problem...

The big problem is that I need to sum all it "valor_tempo" put it on the last registry... that is the one with the code "24B3073B-F45F-4E87-9796-55F37847473D" and then set the "valor_tempo" to 0 to the other registry...

Did you get the ideia ??

Thanks

View 1 Replies View Related

Database Saving Place

Nov 11, 2006

Hello,

My english is not the best, but i will try my best.

I want to change the saving folder for the database from my systempartition to my datapartition (from c:labla to d:mydata), but i dont know how. I can see the folder but it is in gray font and unchangeable.

Greetings Thomas

View 1 Replies View Related

Instead Of Trigger And In-Place Updates

Sep 18, 2007



Converting an existing application, I have a table:


create table problem
(

building char(3),
function char(4),
sqft int,
pct dec(5,2)
)

[pct] is a problem because it depends on it's own row and the sum of all other rows for the same building:

pct = sqft / sum(sqft) over building

I want to create a trigger to update the pct column in the database instead of any business layer. But, because it's updating itself I will use an Instead Of trigger that is separate from the table's Insert & Delete triggers.

The table has a primary key defined such that 'In-Place' updates will be used, that was a technique for reducing disk activity way back when and I can find no reference to it in SQL2005 BOL.

My question is, does the 'Inserted' table still exist for 'In-Place' updates? Or more basically, does the In-Place update still exist?

Thanks.

View 3 Replies View Related

Package Works In One Place And Not Another

May 20, 2008

I'm having a problem with a simple audit package.
I have a sub-select query with parameters in a SQL task. now from what I gathered we must do this as an expression so my SqlStatementSource expression is:

"UPDATE [Table1]
SET column1 = GetDate(), Success = 'Y'
WHERE
column2 = ? and column3 = ? and
Success = 'I' and column4 = (select Max(Column4) from [Table1] where column2 = ?)"

My package is saved on a network drive. When i execute this package from a RDC to another computer (the server) green lights all the way. When I execute the exact same package from my computer, RED RED RED!!!

I get the following:

Error: 0xC002F210 at [. . my query. . .] failed with the following error: "Parameter Information cannot be derived from SQL statements with sub-select queries. Set parameter information before preparing command.". Possible failure reasons: Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly.


My query is already an expression so I dont know what else to do especially since it works one place and not the other. Am I missing something? (I don't want to use an SP)

View 5 Replies View Related

Insert Does Not Take Place If Stored Procedure Is Run From ASP.NET

May 8, 2007

Hello,
I am having an issue with the insert command in a stored procedure in SQL Server 2005. The procedure is designed to generate a Customer number and insert an initial value (a delivery charge) into an order table. Finally, it returns the customer number back to the caller. When I execute the stored procedure from SQL Server Management Studio, it works perfectly. However, when I call it from ASP.net, the procedure properly generates a Customer Number and returns it to my application, but the insert never takes place. Can someone help me figure out why it won't insert?
My ASP.Net (C#) code is here: SqlDataSource dsSelect = new SqlDataSource();
dsSelect.ConnectionString = ConfigurationManager.ConnectionStrings["obeConn"].ConnectionString;
dsSelect.SelectCommandType = SqlDataSourceCommandType.StoredProcedure;
dsSelect.SelectCommand = "getTempCustNo";

DataView reader = (DataView)dsSelect.Select(DataSourceSelectArguments.Empty);

Session["CustNo"] = reader[0]["CustNumber"].ToString().Trim();
Session["PriceCode"] = reader[0]["PriceCode"].ToString().Trim();
Session["orderNo"] = reader[0]["OrderNo"].ToString().Trim();  
  My stored procedure is here:ALTER PROCEDURE [dbo].[getTempCustNo]
AS
BEGIN
declare @CustNo int;
declare @prodDesc VARCHAR(max);
declare @prodNo int;
declare @stdPrice float;
declare @orderNo int;
declare @priceCode int;

-- populate values
SELECT @custNo = ISNULL(MAX(OD_CUSTNO)+1, 100000000), @prodNo = 999, @orderNo = 1, @priceCode = 1000
FROM [dbo].[tblOrderDet]
WHERE OD_CUSTNO >= 100000000;

-- get the price of our product
SELECT @stdPrice = PR_RATE_1
FROM tblPrices
WHERE PR_PRODNO = @ProdNo
AND PR_RCDCOD = @priceCode;

-- get the description
SELECT @ProdDesc = PM_PRDESC + ' ' + PM_VOLUME FROM dbo.tblPromas WHERE PM_PRODNO = @ProdNo;

--Add a delivery charge to the customer's order table
INSERT INTO tblOrderDet (OD_ORDRNO, OD_CUSTNO, OD_PRODNO, OD_QUANTITY, OD_ORG_QUANTY, OD_PRICE, OD_DESCR, OD_LOW)
VALUES (@orderNo, @CustNo, @prodNo, 1, 0, @stdPrice, @prodDesc, 'N');

--Return the customer values
SELECT @custNo AS 'CustNumber', @orderNo AS 'OrderNo', @priceCode AS 'PriceCode';
END 

View 3 Replies View Related

Good Place To Start Learning

Dec 26, 2007

Hello,
Could anyone please suggest a good resource to learn and practice various concepts of SQL like stored procedures etc.?  I tried looking at www.w3schools.com but it doesn't seem to go into the details of stored procedures, triggers, cursors, roll backs, commits  etc.
Thank you.

View 1 Replies View Related







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