I am having a serious problem developing my reports within VS2005. For no reason, on one of my report it seems the parameters have got a life of there own.
There is a collection of 4 parameters whose values change randomly (internal, hidden, multivalue). Regardless of what I set them to, once I click save some change, when I alter 1 parameter, the values of one of the other parameters change while the settings for the parameter I changed to not apply.
What is going on here, I have been developing reports without issue however this is becoming a major concern. Please help!
I have parameters in my report. The user can choose the year, month and date (3 parameters). Now I want to set default vaules for the parameters , so that the user sees the report for example for the current day without selecting the parameters. I tried to set the type of the parameters to DateTime and the default value for example for the year to "=Today().Year" . But when I execute the report an error occures . Something like : no validValue for this parameter.
My Attributes for the year month and date are from an Analyis Services Cube from a Server Time dimension . Does somebody know how to make it possible to set default values for this parameters?
Other question :
Does somebody know how I can reduce the values for a parameter. For Example I have a parameter "year" from a server time dimension from a cube. The values which are available are "Year 2004", "Year 2005", "Year 2006", "Year 2007". But I want that the user only can choose "Year 2006" or "Year 2007" ant not every Year or "All". Or Other Example: The User should only choose a Date that is int the past or Today but not a Date in the future.
Is it possible to fill a parameter list with values based on another parameter value? Here's what I have so far (which hasn't worked)... I'd like to generate a report listing information for a student. The report viewer would first select a school from the first drop-down menu, and then the second drop-down menu would populate with the list of students at that school. I have a dataset that calls a sp which returns a list of schools (SchoolID and SchoolName fields from the database table). I have another dataset that calls a sp (with SchoolID as the parameter) which returns a list of students for that school. Both datasets return the appropriate data when tested individually, but when I set up the Report Parameters and build the report, these errors come up... The value expression for the query parameter '@SchoolID' refers to a non-existing report parameter 'SchoolID'. The report parameter 'Student' has a DefaultValue or a ValidValue that depends on the report parameter "SchoolID". Forward dependencies are not valid. ...Is it possible for the reoprt to generate a list of available parameter values based on the value selected for another parameter? Any help you can give me would be great!! Thank you
I have my stored procedure set to Territory_code IN (@Territory)
, now , how do i enter in more then one value. When i select the multi value check box, it gives me more spaces. But then doesnt recognize the values when i put in more then one. am i doing something wrong?
I have a parameter (hidden) that gets its value using an expression base on another parameter. When in the designer, the first time when the designer loads I can select the Parameter that controls the child parameter (expression lies in the default value section). The value changes.
When I change the parent parameter again, the value of the child parameter does not seem to change.
How can I make this parameter change automatically when the parent is changed ?
If I have a Select statement like this in my C# code: Select * From foods Where foodgroup In (@foodgroup) And I want @foodgroup to have these values ... "meat", "dairy", fruit", what is the correct way to add the parameter? I tried meat, dairy, fruit 'meat', 'dairy', 'fruit' but neither worked. Is this possible?
ok I will post no code this time. I need help I have tried a half of dozen methods and they all only work half way. I need to create a search page that searches on all keywords in a textbox. I have tried split functions, like commands, freetext catalogs. I want to go with the free text search. How? Has anyone used a freetext search in asp or c#? please post some code I re arrange it or let me know how to pass the freetext search param to the sql server..... Please.....
Hey all,I need to import an excel file into a SQL table. Users are able to modify and save the excel file. I have a stored procedure that calls a structured storage file which does the import. Both the excel file and the structured storage file reside in the same location. The first time that the stored procedure fires the DTS it works fine, but if the data in the excel file is overwirtten by a user it appears that the import does not function.Am I missing something here?Here is the SPROC:CREATE PROCEDURE [dbo].[importEmployees] AS DECLARE @object intDECLARE @hr int --create a package objectEXEC @hr = sp_OACreate 'DTS.Package', @object OUTPUTif @hr <> 0BEGIN print 'error create DTS.Package' RETURNEND EXEC @hr = sp_OAMethod @object, 'LoadFromStorageFile', NULL, 'C:importEmployees.dts', ''IF @hr <> 0BEGIN print 'error LoadFromStorageFile' RETURNEND EXEC @hr = sp_OAMethod @object, 'Execute'IF @hr <> 0BEGIN print 'Execute failed' RETURNEND GO
Hiya! I have a VB6 app using ADO to connect to SQL Server 7. On one form I am doing two consecutive inserts and I want them to be wrapped in a transaction for integrity. My code looks like this: connection.errors.clear connection.begintrans connection.execute statement 1 connection.execut statement 2 if connection.errors.count > 0 then connection.rollbacktrans else: connection.committrans.
On the BeginTrans line I get the following error: -2147168227 "Transaction cannot start because more than one ODBC connection is in use". My NativeError is 0, I searched BOL and couldn't find anything informative so I think this is an ADO error only. Also, running sp_who in SQL showed everything was OK. So what's causing this error?
Hi! Have you ever wanted to make life easier? Well, so I am :-)
I have to understand old database ported to ms sql server 2000. Well, the problem is that there are no primary keys at all, no constraints. Database logic is thrown onto triggers and Delphi applications. All fields that should be primary key are in people heads...just mentally :(
Well, you'll say try to find equal fields in different databases... well i was trying to do this. It's impossible...
Let me please start off by saying if your response to this question is:
"That's retarded! Why are you doing it that way! Do it this way!"
Please refrain from answering my query. With that out of the way, here I go.
I have attached a Sql Server 7.0 db (.mdf and .ldf file) to an instance of MSSQL 2000. When this attach happens, MSSQL2000 automatically upgrades it.
I then detach the db, and place the modified files back into the directory the Server 7.0 instance looks for. Obviously the format of the db files (.mdf and .ldf) have changed following the upgrade. I need to know if there is anything I can do (script or programmatically) to modify the files so that my Sql Server 7.0 instance can read them properly when the engine goes online.
Thank you in advance for any tidbits you can provide
Is this at all possible to do. I have been stuck for a couple of hours trying.
SELECT DISTINCT ItemTag, ItemBinLocation FROM VInventory WHERE ( SELECT CASE x WHEN 'x' THEN (LEFT(ItemBinLocation, 1) = 'abc' WHEN 'y' THEN LEFT(ItemBinLocation, 3) = 'efg' END FROM dbo.OtherTable )
I keep getting this stupid error, if any of you have time to kill and could look at this I would really appreciate it. This checks for a login in the database and if it already exists it makes it unique.
In the error message, €˜ssewell504€™ was the value returned after the proc ran, the last 3 digits will be different each time it€™s ran.
Thanks guys and take care!Here's the error:
"Syntax error converting the varchar value 'ssewell504' to a column of datatype int"
ALTER proc [dbo].[spx_CONS_CheckLoginUnique]
( @SourceLogin varchar(25) = 'ssewell', @TargetLogin varchar(25) = 'ssewell' ) as begin declare @ReturnedValue int declare @AlreadyInUse int declare @AppendedValue varchar(3) declare @Range int
set @Range = 999 set @AlreadyInUse = 1 -- set flag
--if target login and source login are the same...we need to change target login if @SourceLogin = @TargetLogin begin while @AlreadyInUse = 1 -- this stays eq to 1 until target login is unique in DB begin Set @ReturnedValue = CONVERT(int, (@Range+1)*Rand()) -- get random num Set @AppendedValue = CAST(@ReturnedValue as varchar(3)) -- cast value to varchar set @TargetLogin = @TargetLogin + @AppendedValue -- append to target login --if by chance this login is already in there(taken), keep going until it's not if EXISTS(select Login_Name from dbo.SECR_Login where Login_Name = @TargetLogin)
begin
set @AlreadyInUse = 1 --set flag to keep looping
end else
begin
set @AlreadyInUse = 0 --set flag to exit out of loop, our login is now unique
Hello!I have tables "forum_topics" and "forum_categories":forum_topics:-topic_id-topic_title-topic_cat_id-topic_user_id-topic_dateforum_categories:-cat_id-cat_name For example: I have 5 categories in table forum_categories and by this query I can display topics from 2nd and 3rd category only. So I'm using this query:SELECT topic_title FROM forum_topics WHERE topic_cat_id IN (2;3)Now I want to parametrized this query by one parameter, so: SELECT topic_title FROM forum_topics WHERE topic_cat_id IN (@param)And I want to input this parameter lik in the query first - so @param = "2;3"But I have a problem to make this works, can someone explain me, how to solve this problem ? Thanks.
Let's say i've got simple table with only one attribute - primary key. I'm populating GridView via SqlDataSource, however dunno how to update PK - how to pass new-updated value and old value (to locate the right record to update) as the UpdateCommand parameters from GridView control. Simple update sample using SQL statement: update TABLE_NAME set PRIMARY_KEY = @NEW_VALUE where PRIMARY_KEY = OLD_VALUE Thank you for your kind help.
In creating a report, how can you display a parameter selection that is a choice (for example, yes/no) where the data that is passed to the query is translated for the query. Selecting 'yes' would pass, for example, 'internal' to the query and selecting 'no' would pass 'external'.
Is this a setting that can be adjusted in Reporting Services, or is this just a matter of how I write my queries?
I am seriously stuck in SQL Reporting Services. And don't know where to go and what to do in order to achieve what I want to achieve.
1. In my report I have the following parameters. SiteID, Document Name, Document Location and Action. These values are picked from the database through queries and filled in the parameter combos.
2. I want the user to be able to view the report for 'Any', 'All' and/or 'None' of the values in the parameter.
e.g. 2.a. The user can generate the report and return all values. 2.b. The user can generate the report with a particular 'SiteID' but all Document Locations, Document Names and Actions. 2.c. The user can generate the report for 'All' SiteIDs, but one Document Location, 'All' Documents and 'All' Actions.
etc.
I was trying this out with parameters. But it wasn't working. Meaning, first of all I wasn't able to get 'All' from the database.
Can someone please help me out, or at least point me in the direction where I should be looking, since I have run out of options.
I have a problem with reports parameters. When I enter the parameter value , Report shows the same value no matter what the parameter value is. Here is my code.
Code Block WITH yesterdayCTE AS ( SELECT type = 'Members Joined Yesterday' , Borrowers = (select count(*) from LoanApplication where LoanApplication.SubmittedOn >= GETDATE()-1) , Depositors = (select count(*) from CDOrder where CDOrder.SubmittedOn >= GETDATE()-1) , CreditUnion = ( select CreditUnion.Name from CreditUnion where (CreditUnion.Id = @CreditUnionID) ) ), last7daysCTE AS ( SELECT type = 'Members Joined Last 7 Days' , Borrowers = (select count(*) from LoanApplication where LoanApplication.SubmittedOn >= GETDATE()-7) , Depositors = (select count(*) from CDOrder where CDOrder.SubmittedOn >= GETDATE()-7) , CreditUnion = ( select CreditUnion.Name from CreditUnion where (CreditUnion.Id = @CreditUnionID) ) ), last30daysCTE AS ( SELECT type = 'Members Joined Last 30 Days' , Borrowers = (select count(*) from LoanApplication where LoanApplication.SubmittedOn >= GETDATE()-30) , Depositors = (select count(*) from CDOrder where CDOrder.SubmittedOn >= GETDATE()-30) , CreditUnion = ( select CreditUnion.Name from CreditUnion where (CreditUnion.Id = @CreditUnionID) ) ), combinedCTE AS ( SELECT * FROM yesterdayCTE UNION ALL SELECT * FROM last7daysCTE UNION ALL SELECT * FROM last30daysCTE ) SELECT * , Members = Borrowers + Depositors FROM combinedC
Hello,I have two tables, Articles and Comments, with the following columns:Articles - [ArticleId] (PK), [ArticleTitle], [ArticleText], [ArticlePubDate]Comments - [CommentId] (PK), [ArticleId] (FK), [CommentTitle], [CommentText]I need to display on a web page the articles published during the last week and their comments.What I need is:1. Get Articles (DONE) 2. Get Comments for each ArticleThe solution I see are:1. Create a Stored procedure that somehow outputs 2 tables: Articles and Comments associated with those articles2. Create 2 Stored procedures: The first one outputs the articles. The second output all comments given an article ID In this case, while the data is being displayed on the page it will load the comments for each article. The problem is that I will have many round trips to the server.I know how to use (2) but this would give me many round trips to the database.Could someone help me out with this?Thanks,Miguel
I posted this scenario earlier and ndinakar said my code worked on (I guess) his own machine but has not worked on mine! Does that not sound funny? I need to ge through with this simple but frustrating stuff in time. I've implemented more complex snippets before this but I just can't figure the problem out.
Can anyone out there tell me what I could be doing wrongly? I wrote a simple stored procedure called 'proc_insert_webuser' in a database that has been moved to a remote server called LAGOS-NTS3. I executed it from SQL Query Analyser and it worked. When, however, I executed the same stored procedure from ASP.Net it gives an impression that a new record has been inserted and even displays the newly generated ID column to me. On checking the base table I found only blank columns with only the ID column having the generated IDs!
I'm perplexed. I checked the code and can't possibly spot the error. Can anyone help. Found below are snippets used.
CREATE PROCEDURE proc_insert_webuser ( @applicantidnumeric(18) output, @firstnamevarchar(18), @midname varchar(18), @lastname varchar(50), @secretcodevarchar(18), @my_errnumeric(18) output ) AS IF (SELECT COUNT(ApplicantID) FROM tbl_webuser WHERE Firstname = @firstname AND Midname = @midname AND Lastname = @lastname) = 0 BEGIN begin transaction INSERT INTO tbl_webuser (Firstname, Midname, Lastname, SecretCode) VALUES (@Firstname, @Midname, @Lastname, @SecretCode) commit transaction SET @applicantid = @@IDENTITY END ELSE BEGIN RAISERROR('Error! Execution aborted. A matching user profile exist.', 16, 1) SELECT @my_err = @@ERROR END RETURN
Then the ASP.Net stuff:
Sub PostData()
'connection string production
Dim cstring As String = "User ID = sa; Password = ; database = E-Recruitment; Server = LAGOS-NTS3; Connect Timeout = 60"
'connection instantiation
Dim cnx As SqlConnection = New SqlConnection(cstring)
Try
'open connection
cnx.Open()
'instantiates and execute a command object
Dim cmd As SqlCommand = New SqlCommand
With cmd
.Connection = cnx
.CommandText = "proc_insert_webuser"
.CommandType = CommandType.StoredProcedure
Dim param1 As New SqlClient.SqlParameter("@applicantid", 0)
param1.DbType = DbType.Single
param1.Direction = ParameterDirection.Output
.Parameters.Add(param1)
Dim param2 As New SqlClient.SqlParameter("@firstname", txtFirstNM.Text)
param2.DbType = DbType.String
param2.Direction = ParameterDirection.Input
.Parameters.Add(param2)
Dim param3 As New SqlClient.SqlParameter("@midname", txtMidNM.Text)
param3.DbType = DbType.String
param3.Direction = ParameterDirection.Input
.Parameters.Add(param3)
Dim param4 As New SqlClient.SqlParameter("@lastname", txtLastNM.Text)
param4.DbType = DbType.String
param4.Direction = ParameterDirection.Input
.Parameters.Add(param4)
Dim param5 As New SqlClient.SqlParameter("@secretcode", txtPWD.Text)
param5.DbType = DbType.String
param5.Direction = ParameterDirection.Input
.Parameters.Add(param5)
Dim param6 As New SqlClient.SqlParameter("@my_err", 0)
param6.DbType = DbType.Single
param6.Direction = ParameterDirection.Output
.Parameters.Add(param6)
.ExecuteNonQuery()
'pick the auto-number
Dim strAppID = .Parameters("@applicantid").Value
'notifies the user of record success
lblMessage.Text = "Profile created. Your ApplicantID is : " & strAppID & " Kindly take note of your UserID. You'll need it for future logins."
End With
Catch ex As Exception
'notifies the user of any error(s)
lblMessage.Text = Err.Description & " originating from " & Err.Source
Finally
cnx.Close()
End Try
End Sub ==================
I'm calling this procedure from the click event of a command button. What could be happening to the code? I have done similar things and got positive results! Any hint from anyone out there?
I have and issue with a query, I tried every thing but I couldn't find why. Here is the issue, I have one big DB1 with about 30 tables, the query based on a join of 5 tables, I have the right index in place, when I run the query it will take about a minute and 20 sec. But I have another DB2 on the same server and I imported just the 5 tables form DB1 with the same index, when I run the same query it will take 6 seconds.
I did drop and recreate the indexes and drop and recreate the statistics but still the same thing no difference.
I'm running SQL7 SP3.
Do you have any idea what might be the issue here?
I'm creating a procedure to fetch rows from table. One field will come come as IN(). Its the condition. That field is numeric field (note down), i would like to pass the In values as parameter.
eg: procedurename @fieldvalue varchar(100) as begin ...
WHERE fieldname IN(@fieldvalue)
while executing the procedure how to pass the value... or procedure itself has problem...? Help me...
Is there any way to validate the input paratemers for the report? For example: I want to restrict the value to be less than 100 in one parameter. How to achieve this?
I have some 5 parameters which I've specified as multi-valued and my report uses a stored procedure. When I select all values in my dropdown (parameters) within my reports nothing shows up. How can I pass multiple values of a parameter into my stored procedure such that it works?
i wanna know ,where to keep configuration parameter values either in an config file (xml), or a parameter table. i have it in xml and its working fine , but for a few of them , i need a greater fleximibility to change the values at any time, so was considering a param table.
the problem is that , a common package which reads the config from xml , now will need to read it from a table , while in case of xml , a file path can be assigned to a variable to be used by the package, but here, i dont have any db connection specification, it may be loaded on various servers. is it feasible..to use a parameter table...??
I am deploying an rdl that is being deployed in a server.But i am encountering a problem regarding the valid values of the parameter.My parameters have dependencies,and one of my parameter comes out with two dependencies.
Scenario : User needs to input his userID to access Book A. Book B needs Book A because the output will be depending on the its content. And Book C depend on Book B.
Problem: when deploying, only Book A will have the initial value.The dependency in Book B is only one,which is fine.It shows its valid values. But how about for Book C which have 2 dependencies? Because it doesnt show it's valid values..
Code Snippet SELECT Portfolio, RptSection, RepExcRsn, Report, SUM( Units) as TotUnits , FROM Exc_SummaryData_Custom WHERE (Report = 'Exc') AND (RepExcRsn = 'Grand Total') AND (RptSection ='New') AND (Portfolio IN (@Portfolio)) GROUP BY Report, RptSection,Portfolio, RepExcRsn
UNION ALL
SELECT DISTINCT 'ALL UP' AS Portfolio, RptSection, 'Grand Total' AS RepExcRsn, Report , CASE WHEN Portfolio = 'ALL UP' THEN (SELECT SUM(Units) FROM Exc_SummaryData_Custom WHERE Portfolio IN ('CBank','DTC','EDirect', 'InstLend','ALL UP')AND (Report = 'Exc') AND (RepExcRsn = 'Grand Total') AND (RptSection ='New') ) ELSE 0 END as TotUnits , FROM Exc_SummaryData_Custom WHERE (Report = 'Exc') AND (RepExcRsn = 'Grand Total') AND (RptSection ='New') GROUP BY Report, RptSection, Portfolio, RepExcRsn
My problem is when I input a value for Portfolio parameter, i get two rows instead of one. If I input 'ALL UP' then I get value only for ALL UP. But if I input smthing else , then I get values for that paramter value as well as ALL UP thus giving me two rows not just one as I want. Case stament always gives me 0 value for ALL UP which is not the true value. can anyone help me to correct this?
Hi Guys, I have a syntax error in my SQL SELECT Query that is driving me crazy. All I am doing is adding a conditional with a literal value and that is breaking the query.This Query Works: SELECT Quantity, CAST(Gallons AS VARCHAR(10)) + ' ' + Style, Colour FROM ORDER_TANK_LINK LEFT JOIN TANKS ON TANKS.TankID = ORDER_TANK_LINK.TankID LEFT JOIN COLOURS ON COLOURS.ColourID = ORDER_TANK_LINK.ColourID This One is Broken:SELECT Quantity, CAST(Gallons AS VARCHAR(10)) + ' ' + Style, Colour FROM ORDER_TANK_LINK ON ORDER_TANK_LINK.OrderID = 1 LEFT JOIN TANKS ON TANKS.TankID = ORDER_TANK_LINK.TankID LEFT JOIN COLOURS ON COLOURS.ColourID = ORDER_TANK_LINK.ColourID Obviously I haven't explained the design of the tables, but because of the fact that I have another query that is so similar working perfectly, I didn't think you'd need it. The exact error is "Incorrect Syntax Near the Keyword 'ON'". OrderID is definately a value of the ORDER_TANK_LINK Table and is of type int. Thanks in advance!
I'm trying to do a basic update query which is working on other pages but not on this page. Dim uid As Integer = CInt(Session("uid")) Dim cmd As New SqlCommand("UPDATE [cvdata] SET [jobCompanyName] = @inputJobCompanyName WHERE [user_id] = @uid", strConn) With cmd.Parameters cmd.Parameters.AddWithValue("@inputJobCompanyName", inputJobCompanyName.Text) cmd.Parameters.AddWithValue("@uid", uid) End With cmd.Connection.Open() cmd.ExecuteNonQuery() cmd.Connection.Close() The funny thing is that if i remove inputJobCompanyName.Text and add a custom value (for example "test") it works.So it doesn't seem to read my updated textfield or something im clueless.Kind regards, Mark
On SQL Server 2000. IBM X series, dual 2GHz Xeon processors, 3GB RAM, RAID 5 DB array and separate Mirrored drive for OS, Windows 2000 Server.
Note: I should have moved the log files to the mirrored volume - I only just noticed it wasn't like that ... oops.:o It only has the OS and backup files (different logical volumes).
Problem: I have a Bill of Material system. It has a batch (Stored Procedure) that explodes Order Line Items. Each line has about 40 components.
The SP has 5 major steps to explode the Assembly, figure out colors/sizes to get the actual part numbers, assign quantities, update flags on the line item table (that has 3,500,000 rows but is not a clustered index - fill factor 85% on the unique autonumber index I use for the updates). The SP is jam packed with User Function calls, sub-Stored Procedures, and (yes) some cursors (on small declared temp tables created for each Order Line processed).
The execution plan for the whole batch of 100 is humongous - like 1000 pages, however nearly all steps are about 16 - 40 milliseconds to execute.
It normally takes 13 seconds to process 100 line items (3900 assembly rows created). However; about every 20th run, it takes 2 or 3 minutes ON THE VERY SAME LINE ITEMS. No programming changes! Run back-to-back, or with a minute or two delay. Then running it again, back to 13 seconds. Sometimes it takes 25 or so seconds, but that oddball 3 minutes is a killer.
I put some timing INSERTs into a temporary log file to localize the problem.
So; here's the REALLY weird thing. The part that experiences the intermittent 2 minute delay is a VERY SIMPLE call to a SP that INSERTs to the tbBATCHs table and gets the identity and passes it back with an Output variable. The tbBATCHs table only has about 8 columns. Nobody else uses it so it's not locking. It has an "If Exists" selection following the Insert to see if another batch is in progress not yet flagged as complete, but's not the issue because it's never true (hard coded values for testing forces this).
I have a Standby Server (duplicate config of main server) so I ran it there. Same issue.
If I loop 100 times on the tbBATCHs INSERT SP, it is pretty quick (like 2 seconds for all 100).
It's never on the first run, so I think it may be some sort of Log File catch-up.
Also; I DO NOT have Transaction Logging in place yet.