when I run a package from a command window using dtexec, the job immediately says success. DTExec: The package execution returned DTSER_SUCCESS (0). Started: 3:37:41 PM Finished: 3:37:43 PM Elapsed: 2.719 seconds
However the Job is still in th agent and the status is executing. The implications of this are not good. Is this how the sql server agent job task is supposed to work by design.
and (jobs.ApplicationsClosed > getdate() OR jobs.ApplicationsClosed = getdate())
The above statement does not pick jobs.ApplicationsClosed= 3/30/2004(that is today'sdate) If I change 3/30/2004 to 3/31/2004 it picks it up. What is wrong with my syntax?
There is a field which I'm doing a sUM() on to get a total for a QtyRecieved from one of the tbls in the SP.. However, the QtyRecieved field is set to be a two decimal place numeric field.
The sp works fine without issues until on the of the qty received is not a round number.
If it's a number with a decimal in it (i.e 5.5) then this is show as a seperate result and not SUM'd with the others.
Any ideas why?
SELECT PDS_Login.Supplier_Products.ProductName, PDS_Login.Supplier_Products.ProductCode, dbo.Suppliers_POs_Details.POID, dbo.Suppliers_POs_Details.PODetailsID, dbo.Suppliers_POs_Details.Qty, dbo.Suppliers_POs_Details.PricePerItem, dbo.Suppliers_POs_Details.PoDetailsStatus, dbo.Suppliers_POs_Details.PoDateExpected, dbo.Suppliers_POs_Details.PODateReceived, PDS_Login.Supplier_Products.UOM, PDS_Login.Supplier_Products.Vatable, dbo.Suppliers_POs_Details.ProductID, dbo.Suppliers_POs_Details.PODetailsStatusReason, SUM(dbo.Suppliers_POs_Details_Received.Qty) AS QtyReceived FROM PDS_Login.Supplier_Products INNER JOIN dbo.Suppliers_POs_Details ON PDS_Login.Supplier_Products.ProductID = dbo.Suppliers_POs_Details.ProductID RIGHT OUTER JOIN dbo.Suppliers_POs_Details_Received ON dbo.Suppliers_POs_Details.PODetailsID = dbo.Suppliers_POs_Details_Received.PODetailsID GROUP BY dbo.Suppliers_POs_Details.PODetailsID, dbo.Suppliers_POs_Details.Qty, PDS_Login.Supplier_Products.ProductName, PDS_Login.Supplier_Products.ProductCode, dbo.Suppliers_POs_Details.POID, dbo.Suppliers_POs_Details.PricePerItem, dbo.Suppliers_POs_Details.PoDetailsStatus, dbo.Suppliers_POs_Details.PoDateExpected, dbo.Suppliers_POs_Details.PODateReceived, PDS_Login.Supplier_Products.UOM, PDS_Login.Supplier_Products.Vatable, dbo.Suppliers_POs_Details.ProductID, dbo.Suppliers_POs_Details.PODetailsStatusReason, dbo.Suppliers_POs_Details_Received.Qty HAVING (dbo.Suppliers_POs_Details.POID = @POID)
I've recently just got started using sub queries. The sub query that I'm running is supposed to select distinct values out of a table. It doesn't seem to be working though.
SELECT id FROM data WHERE (issueID IN (SELECT DISTINCT issueID FROM data))
When I execute this query, it returns a list of id's, but they don't each have a unique issueID. In the data table, issueID can appear more than once (hence, I need to use distinct). However, id is the primary key, and is unique.
In a stored procedure the following code snippet 1 checks against duplicate data being inserted. I've tested it with snippet 2 and it works as expected. However, when the procedure is called from ASP.NET the check seems ineffective. I still get the error msg. The application uses a SqlDataSource with the following parameters.
Any suggestions?
Thanks,
Bakis.
PS I want to ask a question on the ASP.NET forum .The login/pwd for this forum "get me in" to the .net forum in the sense that when I log in I see a logout link. I don't get an "ask a question" button though. Is there a separate screening for each forum?
<UpdateParameters>
<asp:Parameter Name="CatItemUID" Type="Int32" />
<asp:Parameter Name="CatName" Type="String" />
<asp:Parameter Name="Item" Type="String" />
<asp:Parameter Name="Quad" Type="Int16" />
<asp:Parameter Name="UID" Type="Int64" />
</UpdateParameters>
snippet 1 :
if (@CatItemComboExists > 0 ) BEGIN --print @CatItemComboExists return 0 END
snippet 2:
begin tran declare @return_status int EXECUTE @return_status = spUpdateCatItemRec 343, 'blah','blih', 2,3 print @return_status rollback
error msg only if proc is called from app
Violation of UNIQUE KEY constraint 'IX_tblCatItemUID'. Cannot insert duplicate key in object 'tblCatItemUID'.
Ok.. I have a web site I am developing in Visual Studio 2005. Its VB based with SQL Server 2005 as the backend. IIS 6 is the web engine and all of this is running on a Windows 2003 Server.
Here is the problem.. I have a form that authenticates a user and then redirects them to another page. The redirection is not working. All I get is 'Your login attempt was not successful. Please try again.' So I decided to trouble shoot a little and I added a Forgot your password control and a Sign up for new account control to the page as well. When I do the Forgot my password it sends me the username and password in an email, but it just refuses to accept them.
If I use the sign up for a new account control it actually lets me into the redirect page but if I log out and try to get back in it fails. Its crazy and if driving me out of my mind.
If someone wants to help me out I would appreciate it. I have been racking my brain over this for too many days.
Thanks in advance...
Mark
Ps. - I have read every thread and tried just about everything regarding this issue. It has to be something stupid and simple that I am overlooking.
I'm trying to run the following SQL against my ntext column, Testtbl.Task I want to replace where the ampersand sign got HTML encoded to "&", and I want to strip it down to only the ampersand sign and deletethe "amp" and the ";".It executes, but I still have the HTML encoding for the ampersand sign if the issue is NOT the first character in the ntext column. If it's the first part of the ntext column, then it works.
I have a problem with a conditional format of the Color property in a matrix report. When the value of the textbox is greater than 0, the color should be Red otherwise it should be Blue. This is implemented via an IIF statement and works perfectly in Preview in Visual Studio 2005.
When the report is deployed, the formatting appears to be ignored and all values are the default value of Black.
Anyone else experienced this problem and, if so, is there a workaround?
VS 2008. I have the following set up. Group1, Group2, Group3 header, Group 3 detail rows..When I set the row visibility (hide based on Group2) on the Detail row, it still shows up when the report is originally rendered.
It should be: Group1 expanded, Group2 collapsed, Group3 header hidden and detail rows hidden It is showing: Group1 expanded, Group2 collapsed, Group3 header hidden, Group3 detail row visible.
I never had this trouble in 2005. Is there something different about row visibility in 2008?
fetch next from emailCursor into @Name,@info, @Recipients,@MyMessage
end close emailCursor deallocate emailCursor
Currently I have two users in my table that I want to send email to, but when the stored procedure runs I got two emails for the last user in the table instead one for each user.
Insert Into Table2 Select * From Table1 Where Column1Val = '4'
As you can see, I don't need any parameters so I havent configured any. Also, there should not be any result set so I shouldnt need to configure a resultset parameter.
Why is the above query failing with
Problems with the query, "ResultSet" property not set correctly, parameters not set correctly, or connection not established correctly
I created a job using the SQL Server Agent of type Operating System Command (CmdExec). The command was to open a web page that will execute a series of batch programs. I tried running the job I created several times and according to the history of the job, it was successful. However, I checked the supposed changes to some records in the database and no changes were done. I also checked the trace log of the web page but there was no information logged.
I'm convinced that the problem is not on the web page since when I tried manually opening the web page through the browser, the changes were done successfully.
For reference, below is the script of the job:
USE [msdb] GO /****** Object: Job [try] Script Date: 05/05/2007 11:06:58 ******/ BEGIN TRANSACTION DECLARE @ReturnCode INT SELECT @ReturnCode = 0 /****** Object: JobCategory [[Uncategorized (Local)]]] Script Date: 05/05/2007 11:06:58 ******/ IF NOT EXISTS (SELECT name FROM msdb.dbo.syscategories WHERE name=N'[Uncategorized (Local)]' AND category_class=1) BEGIN EXEC @ReturnCode = msdb.dbo.sp_add_category @class=N'JOB', @type=N'LOCAL', @name=N'[Uncategorized (Local)]' IF (@@ERROR <> 0 OR @ReturnCode <> 0) GOTO QuitWithRollback
I have a couple of queries that i run on my server but i need to automate them now. I have created a new job in the sql agent jobs and set up my steps accordingly.
My queries all run in a query window without trouble and they also parse in the command window of the sql agen job-step screen. When I run them manually, it fails with the first query moaning about my variables etc etc.
Is there some sort of limitation that i am not aware of or something?
x.value('Description[1]','VARCHAR(255)') as description,
x.value('Url[1]','VARCHAR(255)') as url,
x.value('Orderable[1]', 'VARCHAR(255)') AS orderable,
x.value('Taxable[1]', 'VARCHAR(255)') AS taxable,
x.value('Path[1]', 'VARCHAR(255)') as htmlpath,
x.value('Caption[1]', 'VARCHAR(255)') as caption,
x.value('Thumb[1]', 'VARCHAR(255)') AS thumb,
x.value('Picture[1]', 'VARCHAR(255)') AS picture,
x.value('(Pricing/BasePrice)[1]', 'MONEY') AS baseprice,
x.value('(Pricing/LocalizedBasePrice)[1]', 'MONEY') AS localizedbaseprice,
x.value('(Pricing/OriginalPrice)[1]', 'MONEY') AS originalprice,
x.value('(Pricing/LocalizedOrignalPrice)[1]', 'MONEY') AS localizedoriginalprice,
x.value('(Pricing/SalePrice)[1]', 'MONEY') AS saleprice,
x.value('(Pricing/LocalizedSalePrice)[1]', 'MONEY') AS localizedsaleprice,
x.value('Availability[1]', 'VARCHAR(255)') AS availability,
x.value('Weight[1]', 'VARCHAR(255)') AS weight,
x.value('OptionLists[1]', 'VARCHAR(255)') as optionlist
FROM @x.nodes('/StoreExport/Products/Product') s(x)
--SELECT * FROM Products
This workings fine, but when I add it to the server agent to run nightly it fails.
The only thing I see for the error is: Message Executed as user: NT AUTHORITYSYSTEM. INSERT failed because the following SET options have incorrect settings: 'QUOTED_IDENTIFIER'. Verify that SET options are correct for use with indexed views and/or indexes on computed columns and/or query notifications and/or xml data type methods. [SQLSTATE 42000] (Error 1934). The step failed.
Can some one explain what happened and how to fix this Dee
I've built a sample CLR function with the following declaration....
CREATE FUNCTION GetManager(@DeptCode nvarchar(3)) RETURNS nvarchar(1000) WITH RETURNS NULL ON NULL INPUT AS EXTERNAL NAME Assembly1.[ClassLibrary1.MyVBClass].MyManager
It returns the value "Unknown" as it would have for any unknown DeptCode, as-programmed.
I'm of the theory it should have returned NULL without actually firing the function? Or is this only for non-CLR items... or stored procedures, not functions?
Grrr!I'm trying to run a script:print 'Declaring cursor'declare cInv cursor forward_only static forselectdistinctinv.company,inv.contact,inv.address1,inv.city,inv.state,inv.postalcode,inv.cmcompanyidfromdedupe.dbo.ln_invoice as invleft joindedupe.dbo.customerid as cidondbo.fnCleanString(inv.company) = cid.searchcowhere((inv.customerid is nulland cid.searchco is null)and (inv.date >= '01/01/2003' or (inv.date < '01/01/2003' andinv.outstanding > 0.01))and not inv.company is null)print 'Cursor declared'declare@contact varchar(75),@company varchar(50),@address1 varchar(75),@city varchar(30),@state varchar(20),@zip varchar(10),@cmcompanyid varchar(32),@iCount int,@FetchString varchar(512)open cInvprint 'cursor opened'fetch cInv into@company,@contact,@address1,@city,@state,@zip,@cmc ompanyidprint 'Cursor fetched @@Cursor_rows = ' + cast(@@cursor_rows asvarchar(5))All the prints are there to help me figure out what's going on!When I get to the Print 'Cursor fetched @@cursor_rows....the value is 0 and the script skips down to the close and deallocate.BUT, if I just highlight the Select...When section, I get over 2,000rows. What am I missing?Thanks.
I would appreciate any help here at all. I am pulling my hair out!
I am unable to start the snapshot agent or log reader agent from within SQL management studio. it fails on executing step 2 with unknown username or bad password.
I have checked all account details and they are correctly using my domain admin account. I can connect to SQL using teh same account and it also has sysadmin permissions.
If i copy the step 2 paramters and start from the cmd prompt (again logged in using the same domain account) they both start fine.
I am testing peer to peer replication in our environment. I simulated a three node peer to peer topology and a local distributor.
For some wierd reason I cannot get the Log Reader Agent and snapshot agent to start. The domain account under which SQL Server Agent runs has administrator previlage on the box. I also use a domain account for SQL Server Service. (none of the passwords changed).
This is the error I am getting - "Executed as user: abc. A required privilege is not held by the client. The step failed"
We just moved source server to newer, bigger box ... Windows 2003 and Active Directory ... Snapshot agent worked but distribution failed ... Same login as on older machine, login is sysadm, used DCOMCNFG to allow ability to launch process ... What are we missing?
I had a view in which I did something like this isnull(fld,val) as 'alias'
when I assign a value to this in the client (vb 6.0) it works ok in sql2000 but fails in 2005. When I change the query to fld as 'alias' then it works ok in sql 2005 . why ?? I still have sql 2000 (8.0) compatability.
Also some queries which are pretty badly written run on sql 2000 but dont run at all in sql 2005 ???
any clues or answers ?? it is some configuration issue ?
I'm trying to use the bcp utility to transfer data from an SQL Server table (CUSTOMERS) to a text file (test.txt).
Here is what I have: DECLARE @FileName varchar(50) SET @FileName = 'C: est.txt'
EXEC bcp BAirwaysDB..CUSTOMERS out @FileName -S<servername> -T
only I keep getting the error: Msg 102, Level 15, State 1, Line 4 Incorrect syntax near '.'.
and when running: bcp BAirwaysDB..CUSTOMERS out C: est.txt -S<servername> -T
on the command line I get: SQLState = 28000, NativeError = 18456 Error = [Microsoft][SQL Native Client][SQL Server]Login failed for user 'RIVERAMelanie'. SQLState = 42000, NativeError = 4060 Error = [Microsoft][SQL Native Client][SQL Server]Cannot open database "BAirways" requested by the login. The login failed.
Can you see where I'm going wrong with this? Any feedback would be really appreciated.
This is a subset question of one of my other threads, the gist is while using forms authentication, I am trying to enter additional information into another table on the same db as the aspnet_membership tables. I think I need an <asp:SqlDataSource> to do this because it is about the only thing left I haven't tried to get this code to work so any help is appreciated. Environment: sql server 2000, windows server 2003, asp.net 2.0, vb, no GUI<ASP:SqlDataSource id="addedInfo" ConnectionString="<%$ ConnectionStrings:SqlServerConnection %>" InsertCommand="INSERT INTO addInfo(username,email,company,firstname,lastname,phone) VALUES (@username,@email,@company,@firstname,@lastname,@phone)" runat="server" />looking over some of my books and online it says in the connectionStrings that it is supposed to be the database name that goes next to the : but when I try that I get an error that it is looking for the name of the connection string, so I enter the name of the connection string (as above) and nothing happens, which is basically the ongoing event with this whole problem, the form fields (username, email, password) that go into the aspnet_membership tables just fine, I don't have any problems with those, it is getting the additional information into another table that has been stalling me the whole time.So does this sqldatasource look right? Any help is appreciated.
Call me an idiot as I'm quite new to asp.net. I'm working through a book called 'ASP.NET Unleashed' where the chapter on how to create a database connection to an sql database on MSDE called 'pubs' is shown. Iv'e installed MSDE. When I try to run the example it says that the login or authentication has failed. Iv'e tried different things but I'm out of ideas. Another thing is that when I try to install sql server 2000 on my Win XP it first says something about this being the wrong OS or something like that. I can get past that but when I'm presented with 3 installation options 1.client 2. client and connectivity 3.connectivity I installed client because that's supposed to create a stand alone installation. However when I'm done installing the only new entry in the start->programs is client connectivity. Where is the Enterprise services that I'm supposed to be able to access according to the book? Is sql server 2000 compatible with XP and not just win 2000?
can somebody tell me whats wrong with this sp..................when i pass lname only or fname only it does not return any data, but when i passs both lname and fname it returns the correct data.....when i rearrange the structure to where it checks the lname only it works also but fname doesn't .........any help is greatlly appreciated
CREATE PROCEDURE [dbo].[temp_search] ( @lname varchar(50) = null, @fname varchar(50) = null, @date1 datetime = null, @date2 datetime = null) /*set @lname = null -- 'aaa'set @fname = null --'ddd'set @date1 = '2/25/2003'set @date2 = '9/30/2004'*/ as set nocount on if not @lname is null or @lname = '' and not @fname is null or @fname = ''begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and temp_user_info.lname like @lname and temp_user_info.fname like @fnameendelse if not @lname is null or @lname = '' begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON cir_temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and temp_user_info.lname like @lname end else if not @fname is null or @fname = '' begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and temp_user_info.fname like @fname end else if not @date1 = null and not @date2 = null begin select cir_temp_user_info.*, dateTime1 FROM cir_temp_user_info INNER JOIN temp_seq ON cir_temp_user_info.temp_seq = temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and dateTime1 between @date1 and @date2 end else if not @date1 = null begin select temp_user_info.*, dateTime1 FROM temp_user_info INNER JOIN temp_seq ON temp_user_info.temp_seq = cir_temp_seq.temp_seq WHERE temp_user_info.temp_seq = temp_seq.temp_seq and dateTime1 like @date1 endGO
I am very new to SQL server and I'm using stored procedures for my program. So far I wrote one tonight, that works just fine. I haven't really written one before, but its kind of similar syntax since I know C++/C# and VB. My question is, even though this works for what I need it do, is it written correctly? Can you see any problems with it, or would you have done it differently? I want to make sure its done correctly, and it runs as fast as possible. Thanks! [pre] CREATE PROCEDURE CreateNewUser @UserID int out, @LoginID nvarchar(30), @Password nvarchar(30), @RegisterDate smalldatetime, @LoginIDExists nvarchar(30)AS /* Check to see if the loginID is already in use before attempting to save it. We MUST have a unique loginID for each user */ SELECT @LoginIDExists = loginID FROM users WHERE loginID = @LoginID /* If we pulled a value from the database, then the loginID already exists, return with error code 1 */ IF (@LoginIDExists = @LoginID) BEGIN SELECT 1 RETURN END ELSE BEGIN /* The loginID does not already exist, attemp to add the new user to the database. */ INSERT INTO users ( loginID, loginpassword, registerDate ) VALUES ( @LoginID, @Password, @RegisterDate ) /* Grab the UserID for the new user. */ SELECT @UserID = @@identity /* return with error code 0 */ SELECT 0 RETURN ENDGO [/pre]
I have a field called contact_id in a table. Datatype is integer and has an identity seed of 1 and an identity increment of 1. When new records are created, the increment sometimes skips numbers. (ex. 12,13,18,21). What's going on here? Am I losing records somewhere?
I have a field called contact_id in a table. Datatype is integer and has an identity seed of 1 and an identity increment of 1. When new records are created, the increment sometimes skips numbers. (ex. 12,13,18,21). There is absolutely no deletion of any kind going on. (i.e. My application (cold fusion) has no code whatsoever that is deleting records.) What's going on here? Am I losing records somewhere?
I am new to SQL Server 2005. I have tried to be a good student and learn on my own about designing the database. However, I am facing a blockage of getting data into the database. I want to verify I have setup the relationships correctly. Here is the tables.
1. A Manufacture has an Address. 2. A Manufacturer has one or more Distribution Points. 3. A Distribution Point has an Address.
The Manufacturer --> Address is a one-to-one relationship. The Distribution Point --> Address is a one-to-one relationship. The Manufacturer --> Distribution Point is a one-to-many relationship.
The manufacturer table has a FK to the address id (PK). The distribution table has a FK to the address id (PK). The distribution table has a FK to the Manufacturer id (PK). Address has several other FK, but not used in this scenario.
The INSERT and UPDATE Specification for the Delete Rule and Update Rule is set to "No Action" for the Manufacturer and Address tables. In the Distribution Point table, the relationship for the update rule involving the relationship with the Address and Manufacturer tables is set to CASCADE. What this tells me is SQL Server 2005 will update the table should changes occur in Address and Manufacturer table.
Is there anything else I can check to be sure the issue I am facing is NOT the deisgn of the database?