If @Title IS NULL Not Working
Jul 3, 2006
I'm building a stored procedure to edit a row in my database but first I'm wanting to check for null values in the parameters and set them to their respective value in the row I'm attempting to edit.
Here's my code:
Code:
CREATE PROCEDURE dbo.spModifyProject
(
@ProjectID int,
@Title nvarchar(50),
@Description nvarchar(50),
@DueDate smalldatetime,
@ProjectLead nvarchar(50),
@Completed bit
)
AS
IF @Title IS Null Then
SET @Title = (SELECT Title FROM Projects WHERE [ID] = @ProjectID)
END IF
I get syntax errors in two places. The first is near Null and the second is near END. Any help you can give is appreciated.
View 2 Replies
ADVERTISEMENT
Jul 3, 2006
I'm building a stored procedure to edit a row in
my database but first I'm wanting to check for null values in the
parameters and set them to their respective value in the row I'm
attempting to edit.
Here's my code:
Code: CREATE PROCEDURE dbo.spModifyProject
(
@ProjectID int,
@Title nvarchar(50),
@Description nvarchar(50),
@DueDate smalldatetime,
@ProjectLead nvarchar(50),
@Completed bit
)
AS
IF @Title IS Null Then
SET @Title = (SELECT Title FROM Projects WHERE [ID] = @ProjectID)
END IF
I get syntax errors in two places. The first is near Null and the second is near END. Any help you can give is appreciated.
View 3 Replies
View Related
May 3, 2006
Hello.
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
And it works as expected, except when I use NULL:
DECLARE @MyManager nvarchar(1000)
EXEC @MyManager = dbo.GetManager NULL
PRINT @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?
View 3 Replies
View Related
Oct 24, 2007
I currently have a stored procedure that looks something like this SELECT * FROM tblQuestions WHERE Title LIKE ISNULL('%'+@Name+'%', Title)I have a form that supplies this value. This statement should make it so that if a NULL value is passed in, then it will return all the rows, if some text is specified, then it will not. On my SQLDataSource on the page where the parameter is supplied I have set ConvertEmptyStringsToNull to True, but when I say in my code,SqlDataSource1.SelectParameters.Add("@Name", TextBox1.Text);It won't give me back any of the rows, I know that the stored procedure works fine because I can get it to work by a basic query and other testing on it, so somewhere in my form, the NULL value isn't being passed, I belive that it is passing an empty string and I don't know why. Thank you in advance /jcarver
View 4 Replies
View Related
Feb 28, 2000
Hello, everyone!
I have some fields that must have data entered into them(i.e they shd not be left blank) & since the data has to be different almost everywhere I cannot set a default also. However I have defined these columns as NOT NULL, but still when data is entered they accept null values. WHY?
Please help!
Thanks in advance!
Adie
View 2 Replies
View Related
Jul 20, 2004
Hi,
I have a problem with a SQL that check if a date column IS NULL.
On one server the check work ok but on another (the same data is on both - restored copy) the check does not find any NULL values.
If check where datecolumn =convert(datetime,'9999-12-31 23:59:59.000',121) I get the same result as when checking for NULL in the other.
Is there any parameter set somewhere that tell the server to return a value even if NULL is stored in the database?
thank you for reading,
YakoBay
View 3 Replies
View Related
Mar 28, 2008
The problem I'm having is described below all this code.---------------------------------------------------------My content page has a SqlDataSource: <asp:SqlDataSource ID="sqlGetUserInfo" runat="server"
ConnectionString="<%$ ConnectionStrings:RemoteNotes_DataConnectionString %>" SelectCommand="SELECT [UserFirstName], [UserLastName] FROM [Users] WHERE ([UserGUID] = @UserGUID)"
onselecting="sqlGetUserInfo_Selecting"> <SelectParameters> <asp:Parameter Name="UserGUID" Type="String" /> </SelectParameters> </asp:SqlDataSource> -----------------------------------------------------Inside my OnSelecting event, I have: protected void sqlGetUserInfo_Selecting(object sender, SqlDataSourceSelectingEventArgs e) { sqlGetUserInfo.SelectParameters["UserGUID"].DefaultValue = Membership.GetUser().ProviderUserKey.ToString(); } ---------------------------------------------------------------------And, inside my Page_Load, the relevant code is: //String strUserFirstName = ((DataView)sqlGetUserInfo.Select(DataSourceSelectArguments.Empty)).Table.Rows[0]["UserFirstName"].ToString();
DataView dvUserDetails = (DataView)sqlGetUserInfo.Select(DataSourceSelectArguments.Empty);
if ((dvUserDetails != null) && (dvUserDetails.Count > 0)) { DataRow drUserInfo = dvUserDetails.Table.Rows[0]; lblHelloMessage.Text = "Hello, " + drUserInfo["UserFirstName"].ToString() + ((drUserInfo["UserLastName"].ToString() == "") ? "" : " " + drUserInfo["UserLastName"].ToString()); } ---------------------Now, here's the problem. My "if" statement is never executing because "dvUserDetails" is null. However, when I break the execution and put awatch on the actual Select() statement, it shows a DataView with the correct return rows! You can see the commented line where I tried tobypass the DataView thing (just as a test), but I get an object reference is null error.The weird thing is that it was working fine one minute, then started getting "funky" (working, then not, then working, then not), and now it just doesn't work at all. All thiswithout me changing one bit of my code because I was checking out some UI flow and stopping and restarting the application. I've tracked downthe temporary files directory the localhost web server runs from, deleted all those files, and cleaned my solution. I've even triedrebooting, and nothing seems to make it work again.My relevant specs are VS2008 9.0.21022.8 RTM on Vista Enterprise x64.
View 3 Replies
View Related
Aug 23, 2007
I have a timestamp column and a username column with default values of getdate and system user in my table and they are defined as not null.
even though i donot use these columns in scd type 2 in wizard
if the columns are not null the scd deosnot work and If the columns are defined null they work
Can anyone please explain or help me with what might be the problem associated with this
View 1 Replies
View Related
Feb 2, 2007
I am update/inserting records threw a web form in vb.net. I need to insert 'NULL' into my microsoft sql server database. I am not talking about the below line of code where website is the name of my paramater. If i do that it will just place a blank into that field in the database. If i dont enter anything into that textbox I want it to to say NULL in that field. So if I go into the actual table in the SQL Server Management Studio and look at the website field of the recored I just added or updated and did not type anything into the web site textbox it needs to say NULL. I also tried the second line of code but that places a single quote in front and behind NULL. So the field will have the value 'NULL'.
website.value = txtwebsite.text.tostirng
if txtwebsite.text ="" then
website.value ="NULL"
end if
The reason why I need the NULL there is because I bind the website filed to a hyperlink template in a gridview. The actual text of the hyperlink is bound to PAYER which is a name of a insurance payer but the navigateto is bound to the website field. If i do not enter any data into the website field and it stays as NULL, then when my gridview is loaded, payers that dont have a website will not be underlined and user wont have the option to click on them since there is no value for the navigateto. But if i use my form to update/add a payer and leave the website textbox blank in puts a blank into that field in my database and when it loads that new row into the gridview the PAYER is underlined and u can click on it but it will just take u to the web site is unavailable page. So is there anyway to actaull have NULL placed into a filed and not just blank space
View 3 Replies
View Related
Sep 20, 2006
Hey. I need to substitute a value from a table if the input var is null. This is fine if the value coming from table is not null. But, it the table value is also null, it doesn't work. The problem I'm getting is in the isnull line which is in Dark green color because @inFileVersion is set to null explicitly and when the isnull function evaluates, value returned from DR.FileVersion is also null which is correct. I want the null=null to return true which is why i set ansi_nulls off. But it doesn't return anything. And the select statement should return something but in my case it returns null. If I comment the isnull statements in the where clause, everything works fine. Please tell me what am I doing wrong. Is it possible to do this without setting the ansi_nulls to off??? Thank you
set ansi_nulls off
go
declare
@inFileName VARCHAR (100),
@inFileSize INT,
@Id int,
@inlanguageid INT,
@inFileVersion VARCHAR (100),
@ExeState int
set @inFileName = 'A0006337.EXE'
set @inFileSize = 28796
set @Id= 1
set @inlanguageid =null
set @inFileVersion =NULL
set @ExeState =0
select Dr.StateID from table1 dR
where
DR.[FileName] = @inFileName
AND DR.FileSize =@inFileSize
AND DR.FileVersion = isnull(@inFileVersion,DR.FileVersion)
AND DR.languageid = isnull(@inlanguageid,null)
AND DR.[ID]= @ID
)
go
set ansi_nulls on
View 3 Replies
View Related
Apr 29, 2007
hey guys, so i have my website, everything is ok, until i have to put in a title field, along side my description. so far i have this code which searches in the description, how can i make it so i can search in the title as well
SelectCommand="SELECT [Stock_ID], [cat_id], [description], [size],
[selling_price], [qty], [picture1] FROM [tbl_stock]
WHERE ([description] LIKE '%' + @description + '%')">
Any help would be great
Cheers
Jez
View 2 Replies
View Related
Feb 13, 2005
I have a table that is a very general layout so I can expand upon values later in the future easily. Basically it looks like this:
Code:
ID PlayerID Ability Score
1 1 STR 18
2 1 DEX 17
3 1 CON 16
What I'm trying to do is create a stored procedure where I pass in a PlayerID and it will return a result set of
Code:
STR DEX CON
18 17 16
It doesn't appear that there's a way in SQL Server 2000 to SELECT a column AS a variable. I suppose I could go about creating a temporary table, but seems like an odd work around to get it to work. Any suggestions? Or am I just missing something obvious?
View 3 Replies
View Related
Nov 16, 2006
Hello,
I am asking this question here, because it appears that I don't get as fast a response in reporting services as I do on this forum.
I am trying to add an extra parameter in a report title called SummaryBy.Value
Here is my current code:
="BY " & UCase(Parameters!SummaryBy.Value & IIF(Parameters!SummaryBy2.Value<>"", " / " & Parameters!SummaryBy3.Value,""))
If I add the extra parameter I get an error because of the IIf. How do I get around this to display all three parameters?
Please let me leave this post here also. I need to get an answer asap.
TIA and have a great day!
Kurt
View 6 Replies
View Related
Jan 10, 2007
I'm new to these forums. If this is not the right place to post this question, please let me know where I should ask. :)
Anyway, I have a report that is grouped something like this:
Team
Location
Score
TEAM 1
#Loc#
#Total#
Home
10
Away
14
Away
8
NULL
0
NULL
0
Home
14
TEAM 2
#Loc#
#Total#
Home
10
Away
14
Home
19
NULL
0
Home
14
TEAM 3
#Loc#
#Total#
Away
7
Away
12
For each team grouping, the header columns needs to perform an action on the grouped records to determine the text.
The #Total# header is easy -- here I want a total of the points ( =Sum(Fields!Points.Value) ). No problem.
The #Loc# header is the problem. What I want to do is to count the number of "Home" values in the group (so Team 1 location reads "Home (2 of 6)", and Team 2 location reads "Home (3 of 5)"). If there are no "Home" values, I want to use the "Away" value (so Team 3 location reads "Away (2 of 2)").
Can someone tell me how I can create a custom code function that will allow me to iterate through the values of the grouped records from the group header textbox? I assume I need to be able to create a custom aggregate function of some kind, but I don't quite know where to begin.
Thanks for your help.
Joe
View 1 Replies
View Related
Apr 30, 2008
i am having a problem querying a field in a database to show all records where the title has a keyword within the title.
Select * FROM tblCourse
WHERE title =@Search
But not the full title just a keyword within the field?
Thanks
View 1 Replies
View Related
Sep 9, 2015
I need to create a report showing the title the first and last name of all sales representatives-This is what I have so far but am having difficulty retrieving ONLY the "Sales Representatives" Titles.
Select Firstname, Lastname, Title
From Employees
Where ???
View 6 Replies
View Related
Sep 21, 2007
Hi All,
I have created a report in SQL Server Business Intelligence Development Studio 2005. I need to add a report title above the parameters area. Is that possible?. please help me
The output should be like
_____________________________________________________________________
Report Title
_____________________________________________________________________
Report Parameters Section View Report button
_____________________________________________________________________
Report Body part.
_____________________________________________________________________
View 1 Replies
View Related
Mar 3, 2008
How do I change the report title via an expression? I have a parameter that can contain 1 of 3 values and want to change my Report Title accordingly. Can I nest the IIF statements somehow or how can I accomplish this?
View 4 Replies
View Related
Apr 23, 2007
Good day,
Is there anyway that I can have a multi-line chart title? I have even tried placing a text box over the title part of the chart that is multi-line, although this appears to work once the report is deplyed and viewed in a web browser the text box appears below the chart and the chart then has no title.
Please can you help?
View 2 Replies
View Related
May 8, 2007
Is there any way to give Title to matrix row and column groups?
I know If i have only one row i can give title in the textbox provided at the top of the Rows group area. But i have more than one row and group and more than one column group. i want to give title to all of them.
Without the title the report looks incomplete
Is there any solution for this problem?
Thanks
Rohit
View 1 Replies
View Related
Sep 21, 2007
Hi All,
I have created a report in SQL Server Business Intelligence Development Studio 2005. I need to add a report title above the parameters area. Is that possible?. please help me
The output should be like
______________________________________________________________________
Report Title
______________________________________________________________________
Report Parameters Section View Report button
_____________________________________________________________________
Report Body part.
_____________________________________________________________________
View 1 Replies
View Related
May 20, 2008
Is it possible to change the title of a chart at run-time?
View 3 Replies
View Related
Nov 15, 2005
Dear Anyone,
View 7 Replies
View Related
Jan 10, 2007
Hello :
In a title of a column of a table, I put a too long text, with sorting, but when I spread (display) the report has a problem on text of the title of the column there.
The probleme settles (arises) when I activate the sorting to post (show) the image of sorting.
How to fit the size of the cell to the text?
Thenk's.
View 2 Replies
View Related
Nov 9, 2007
Hi,
This maybe a very simple question but somehow I cannot find the way to do it.
1. How to delete Subtotal in Matrix by using Report Designer (Visual Studio).
It looks simple, but after I click on the Total and right click - delete. Somehow only the text "Total" being deleted and not the whole row. I still can see the grey cell in my matrix table
2. How to create link from the value in Total in Matrix
We can add the link in the Data via navigation and jump to another report by passing the parameter, but the Total value will follow whatever we have set in the Data. Which means that it will passing the parameter as well. How to enable the link via the Total value and remove all the previous filter and jump into my other report without any filter value ?
3. How to create drill up function in matrix ?
For example I have 2 Reports, 1st report is Region (AP, EMEA, US), 2nd Report is Country
When I click on 1st report and click on AP, it will open up another report and show country like Hongkong, Indonesia, Singapore
Now, I want to click on AP in 2nd report and going back to 1st report by showing all AP, EMEA, US.
When I click on AP in 2nd report, I am going to pass the parameter of Region there and still I want to show AP, EMEA, and US.
4. How to show the Title in Matrix ?
I cannot find a way to show the Field name as the title in the Matrix for column grouping. Anyone can help me ?
Millionz thanks if you can help to answer this.
Cheers
Tanipar
View 1 Replies
View Related
Oct 18, 2007
Hi,
Please give me some idea to persist or set title of modal dialog during postback.
The title of modal dialog is going lost whenever postback happen on modal dialog.
document.title is not working after postback.
Thanks,
Sandeep, India
View 1 Replies
View Related
Nov 16, 2007
Hi all,
I want to show the above. Can someone elighten me how I can loop thru to concatanate the values?
Regards,
Farouk Yew
View 1 Replies
View Related
Jan 15, 2015
I have a query to get data group by High, Medium and Low so only three rows will be returned.
select
sum(case .... ) then 1 else 0 end) as [Column1],
sum(case .... ) then 1 else 0 end) as [Column2],
sum(case .... ) then 1 else 0 end) as [Column3]
from sometable
Group by High, Medium, Low
I want to manually add High, Medium and Low to each row's first column. the final result should look like:
Column1 Column2 Column3
High 123 123 123
Medium 123 123 123
Low 123 123 123
How can I do it?
View 2 Replies
View Related
Apr 1, 2014
--===== If the test table already exists, drop it
IF OBJECT_ID('TempDB..#mytable','U') IS NOT NULL
DROP TABLE #mytable
--===== Create the test table with
CREATE TABLE #mytable
(
EMP_ID INT,
Title varchar(50),
DateValue DATETIME,
TITLE_YEAR INT,
[code]....
I am new to this level of coding in SQL SERVER 2012, but I am looking to update the TITLE_YEAR field in the temp table with the Year the employee is in that title. For example for employee 11127 the data should look like this:
EMP_IDTitle DateValue TITLE_YEAR
3 Senior Consultant 2009-01-01 00:00:00.0001
3 Director 2010-01-01 00:00:00.0001
3 Director 2011-01-01 00:00:00.0002
3 Director 2012-01-01 00:00:00.0003
3 Director 2013-01-01 00:00:00.0004
3 Senior Director 2014-01-01 00:00:00.0001
View 6 Replies
View Related
Nov 26, 2013
I need to put a title for a radial gauge. I've tried to add a label, but it remains in the panel area.
Is it possible to add a title by using a gauge property without creating a text box outside this object?
View 7 Replies
View Related
Jul 29, 2015
On SSRS 2008 R2 I've set the Action of a pie chart title to Go to URL. When I run the report in the browser the title can be clicked and all is well.
However, when I export/render the report to pdf, the hyperlink disappears. I've tested with a small URL, but that fails as well. I've also tried the same URL in the Action of a text box and that works fine. But, I don't want a text box on top of the chart (which comes with its own positioning issues) and use the more elegant approach of having the link in the title instead.
I'm assuming this is a SSRS limitation? Re-writing the url or making it shorter does not have any effect.
View 4 Replies
View Related
May 25, 2015
I have a SSRS report in which we have a subreport i am trying to hide the link in excel after exporting from report documents, in report my logic is working fine but when we are deploying in SharePoint application then it is not working. Report is not opening.
View 2 Replies
View Related
Apr 20, 2007
Hi all,
I am trying to build a reportviewer so that I could use reporting services (due to company's security policy).
I am getting a VERY weird error here.
Before I get on ahead, here is the scenario.
I had created a rdl that will give a certain report based on two parameters. At the moment, I didn't assign the parameters to any default values since i don't want the report to start running. These two parameters are run based on stored procedures to get the starting date and an ending date.
I had tried to view this report on Report Manager and it works.
I had set the parameters this way. NOTE: ReportingServer is the disgused name of the reportserver I am using for privacy purposes
Code Snippet
Dim rs As New ReportingServer.ReportingService
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
'Render arguments
Dim results() As Byte
Dim format As String = "HTML4.0"
Dim historyID As String = Nothing
'PDF Rendering extensions don't have any useful DeviceInfo settings
'the toolbar shown below only affects HTML rendering
Dim devInfo As String = "<DeviceInfo><HTMLFragment>True</HTMLFragment><JavaScript>True</JavaScript><Toolbar>True</Toolbar><Parameters>True</Parameters></DeviceInfo>"
Dim credentials() As ReportingServer.DataSourceCredentials = New ReportingServer.DataSourceCredentials() {}
Dim showHideToggle As String = ""
Dim encoding As String = ""
Dim mimeType As String = ""
Dim warnings() As ReportingServer.Warning = New ReportingServer.Warning(0) {}
Dim reportHistoryParameters() As ReportingServer.ParameterValue = New ReportingServer.ParameterValue() {}
Dim streamIDs() As String = Nothing
Dim sh As ReportingServer.SessionHeader = New ReportingServer.SessionHeader
rs.SessionHeaderValue = sh
But when I started building this reportviewer.aspx, it gives me this error on the following line:-
Code Snippet
results = rs.Render(ReportPath, format, historyID, devInfo, Parameters, credentials, _
showHideToggle, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
with the error
{"This report requires a default or user-defined value for the report parameter 'start_date'. To run or subscribe to this report, you must provide a parameter value. --> This report requires a default or user-defined value for the report parameter 'start_date'. To run or subscribe to this report, you must provide a parameter value. --> This report requires a default or user-defined value for the report parameter 'start_date'. To run or subscribe to this report, you must provide a parameter value."}
this is occuring on the line where it needs to render the report.
As simple as it is, i tried the following:-
NOTE: some variables has been changed to protect some identity.
Code Snippet
Dim ReportRenderer As New RenderSQLReports
Dim Parameters As int.rrd.sqlreporting_test.ParameterValue() = Nothing
ReportRenderer.RenderReport(Parameters, "/Folder/reportname", "pdffilename.pdf")
What I don't get is that i made sure that it doesn't have any default values.
So I went into this scenario and tried teh following:-
Code Snippet
Dim ReportRenderer As New RenderSQLReports
Dim Parameters() As Reportingservices.ParameterValue = New Reportingservices.ParameterValue(1) {}
Parameters(0) = New Reportingservices.ParameterValue
Parameters(0).Label = "start_date"
Parameters(0).Name = "start_date"
Parameters(0).Value = "10/1/1999 12:00:00 AM"
Parameters(1) = New Reportingservices.ParameterValue
Parameters(1).Label = "end_date"
Parameters(1).Name = "end_date"
Parameters(1).Value = "11/1/1999 12:00:00 AM"
ReportRenderer.RenderReport(Parameters, "/Folder/reportname", "pdffilename.pdf")
And this is what happens. It blows up on this line again. with this error.
Code Snippet
results = rs.Render(ReportPath, format, historyID, devInfo, Parameters, credentials, _
showHideToggle, encoding, mimeType, reportHistoryParameters, warnings, streamIDs)
With the errors
{"Default value or value provided for the report parameter 'start_date' is not a valid value. --> Default value or value provided for the report parameter 'start_date' is not a valid value. --> Default value or value provided for the report parameter 'start_date' is not a valid value."}
This is probably occuring because the date I had provided is not found in the list of dates. I really don't want to default a date at the moment, to allow the user to select a date.
So I finally gave it a date...... a valid date.
Code Snippet
Dim ReportRenderer As New RenderSQLReports
Dim Parameters() As Reportingservices.ParameterValue = New Reportingservices.ParameterValue(1) {}
Parameters(0) = New Reportingservices.ParameterValue
Parameters(0).Label = "start_date"
Parameters(0).Name = "start_date"
Parameters(0).Value = "10/1/2004 12:00:00 AM"
Parameters(1) = New Reportingservices.ParameterValue
Parameters(1).Label = "end_date"
Parameters(1).Name = "end_date"
Parameters(1).Value = "11/1/2004 12:00:00 AM"
ReportRenderer.RenderReport(Parameters, "/Folder/reportname", "pdffilename.pdf")
LO and behold, it works BUT . now i get this error in the aspx code.
Runtime error has occured.
Microsoft JScript runtime error: 'Report' is undefined
on this weird line:- (that was generated automatically)
</script><script language="javascript" type="text/javascript" src="?rs:Command=Get&rc:GetImage=8.00.1038.00Report.js">
</script><script language="javascript" type="text/javascript">
<!--
function OnLoadReport()
{
var pageHits = null;
var rep = new Report(1, 16, pageHits, false, docMapIds); <-where error is occuring.
if (parent != self) parent.OnLoadReport(rep);
}
//-->
</script>
It did show the report, but I don't understand why it is still getting an error here. Moreover, I didn't even get the HTMLViewer too even when I had assigned the devinfo....
Really need some help here, as this is quite urgent.... I am at a loss at this, and maybe that there is an option that I am not seeing or something I am missing. please help .
Bernard-So close yet so far, How cruel are the software bugs-
View 4 Replies
View Related