Socal Media Productions

Blogs for Programming and IT Consulting.

Friday, April 12, 2013

'perfutil.h': No such file or directory

'perfutil.h': No such file or directory error: command '"c:\Program Files\Microsoft Visual Studio 9.0\VC\BIN\cl.exe"' failed with exit status 2

 

I recieved this during a Python for windows extensions installation.

goto:

http://sourceforge.net/projects/pywin32/files/pywin32/Build%20218/

 

and select the right package for your version of python.

pywin32-218.win32-py2.7.exe

 

That should solve the issue.

 

Thursday, February 28, 2013

ERROR OGG-00212 Invalid option for MAP:

ERROR   OGG-00212  Invalid option for MAP:

 

I recieved this error when trying to set up a replicant for Golden Gate replication.  The error was in the paramter file (.prm).

errored line:

MAP \servername.SCHEMA.TABLE,Target SCHEMA.TABLE;

 

correct entry:

MAP \servername.SCHEMA.TABLE, Target SCHEMA.TABLE;

 

a space is required

MAP \servername.SCHEMA.TABLE,[space]Target SCHEMA.TABLE;

 

The GG error is generic and does not cover all the lines that had this problem.  I had 14 tables missing a space and the error only listed a mapping issue with one line, second to last from the bottom.

Strange.

 

Good Luck.

 

 

 

Sunday, November 04, 2012

Flasher Program for ATTiny84

Here is a script to flash 8 LED's connected to the PINA I/O. I am not including the circuit with the code. But is a very simple configuration with a button on PINB 1.

 

good luck

 


.def temp = R16
.def counter = R17
.def temp1 = R18
.def i = R19
/*.def delay = R28*/
.def tog = R29

 
    rjmp Init

; Delay subroutine
/*DebounceDelay:
    push temp    ;place on stack in order
    push temp1    
    ldi temp, 0x80     ; 10000000
    ldi temp1, 0x38    ; 00111000
    ldi Delay3, 0x01    ; 00000001

WastingTime:    ; cascade values from high reg to low until 0 = 1 second
    subi temp, 1       ; (temp -1) : result to temp : carry bit to high reg : 1 cycle
    sbci temp1, 0      ; (temp1 - (1 + CARRY BIT) ) : result to temp1 : carry bit to high reg : 1 cycle
    sbci Delay3, 0    ; (1-1) : (delay3 - (1 + CARRY BIT) ) : 1 cycle
    nop               
    nop
    nop
    nop                ; making up 10 cycles
    cpi temp, 0        ; compare temp = 0
    brcc WastingTime   ; 2 cycles   
    pop temp1
    pop temp
    ret*/

P0:
    ldi R20, 0b10000000     ; code for 0
    ldi R21, 0b11000000     ; code for 1
    ldi R22, 0b11100000     ; code for 2
    ldi R23, 0b11110000     ; code for 3
    ldi R24, 0b11111000     ; code for 4
    ldi R25, 0b11111100     ; code for 5
    ldi R26, 0b11111110     ; code for 6
    ldi R27, 0b11111111     ; code for 7

    clr i    ;set i = 0
    rjmp SetReg; skip to processing

P1:
    ldi R20, 0b11111111     ; code for 0
    ldi R21, 0b11111110     ; code for 1
    ldi R22, 0b11111100     ; code for 2
    ldi R23, 0b11111000     ; code for 3
    ldi R24, 0b11110000     ; code for 4
    ldi R25, 0b11100000     ; code for 5
    ldi R26, 0b11000000     ; code for 6
    ldi R27, 0b10000000     ; code for 7

    clr i    ;set i = 0
    rjmp SetReg; skip to processing

P2:
    ldi R20, 0b10000001     ; code for 0
    ldi R21, 0b11000011     ; code for 1
    ldi R22, 0b11100111     ; code for 2
    ldi R23, 0b11111111     ; code for 3
    ldi R24, 0b11100111     ; code for 4
    ldi R25, 0b11000011     ; code for 5
    ldi R26, 0b10000001     ; code for 6
    ldi R27, 0b00000000     ; code for 7

    clr i    ;set i = 0
    rjmp SetReg; skip to processing

P3:
    ldi R20, 0b10000000     ; code for 0
    ldi R21, 0b01000000     ; code for 1
    ldi R22, 0b00100000     ; code for 2
    ldi R23, 0b00010000     ; code for 3
    ldi R24, 0b00001000     ; code for 4
    ldi R25, 0b00000100     ; code for 5
    ldi R26, 0b00000010     ; code for 6
    ldi R27, 0b00000001     ; code for 7

    clr i    ;set i = 0
    rjmp SetReg; skip to processing

P4:
    ldi R20, 0b11100000     ; code for 0
    ldi R21, 0b00011000     ; code for 1
    ldi R22, 0b00011000     ; code for 2
    ldi R23, 0b00000111     ; code for 3
    ldi R24, 0b00000111     ; code for 4
    ldi R25, 0b00011000     ; code for 5
    ldi R26, 0b00011000     ; code for 6
    ldi R27, 0b11100000     ; code for 7

    clr i    ;set i = 0
    rjmp SetReg; skip to processing

SetReg:
    nop
    cpi tog, 1
    brne PC+3
    clr tog
    ret

    ;**********Clear Counter******
    cpi i, 8        ; counter = 7
    brne PC+2    ; NOT EQUAL: program counter jumps forward 2 instructions:used instead of label jumps
    clr i ; EQUAL, reset to 0

    ;********** Enable segments Based on Counter*****
    ldi ZH, 0    ; zeros ZH to R0
    ldi ZL, 20    ; zeros ZL to R20
    add ZL, i    ;adds counter to ZL
    ld  temp1, Z    ;reads Rx into temp1

    ldi temp, 0x00 ;0x80    ;LOADS temp with 10000000
    or  temp, temp1  ;OR's values: result into temp
    out PORTA, temp ; OUTOUT temp to PORTA : PA7 high, others controled by the digit value

    rcall FlasherDelay
    inc i     ; NO, increase counter

    ;*****Check Button Press*****
    sbic PINB, 1 ; PB1 pressed?
    rjmp SetReg   ; no, do nothing
    ldi tog, 1
    ;*****Check Button Release*****
Release:
    sbis PINB, 1 ; PB1 released?
    rjmp Release ; no, loop
    rcall DebounceDelay; insert delay
    rjmp SetReg
       

/*FlasherDelay:
    push temp    ;place on stack in order
    push temp1    
    ldi temp, 0x7C     ; 124 take about .1 sec
    ldi temp1, 0x00    ;
    rjmp WastingTime    ; skip the delay section
DebounceDelay:
    push temp    ;place on stack in order
    push temp1    
    ldi temp, 0xFA     ; 250 take about 2 sec
    ldi temp1, 0x00    ;
   
    WastingTime:    ;
    subi temp, 1       ;
    sbci temp1, 0      ;
    brcc WastingTime   ;    
    pop temp1
    pop temp
    ret */

FlasherDelay:
    push temp    ;place on stack in order
    push temp1   
    push i
    ldi temp, 0x80     ; 10000000
    ldi temp1, 0x38    ; 00111000
    ldi i, 0x01    ; 00000001
    rjmp WastingTime    ; skip the delay section
DebounceDelay:
    push temp    ;place on stack in order
    push temp1    
    push i
    ldi temp, 0x80     ; 10000000
    ldi temp1, 0x38    ; 00111000
    ldi i, 0x01    ; 00000001
   
WastingTime:    ;
    subi temp, 1       ;
    sbci temp1, 0      ;
    sbci i, 0
    brcc WastingTime   ;        
/*
    nop
    nop
    nop
    nop
*/
    pop i
    pop temp1
    pop temp
    ret

Init:
    ldi temp, 0x040    ; 01000000
    out DDRB, temp  ; PORTB pin 2 for output, others for input
    ldi temp, 0xFF  ; 11111111
    out DDRA, temp    ; PORTA Pins for output
    sbi PORTB, 1    ; enable pull-up for PB1
    clr counter     ; set counter to 0 initial value   
    ldi tog,0        ; set tog =0

Start:
    ;**************** enable digits***********
    sbi PORTB, 2 ; PB2 high 
    sbi PORTA, 7 ; PA7 high


    ;**********Check Counter******
    cpi counter, 0        ; counter = 0
    brne PC+3    ; NOT EQUAL: program counter jumps forward 2 instructions:used instead of label jumps
    rcall P0
    inc counter     ; increase counter

    cpi counter, 1        ; counter = 0
    brne PC+3    ; NOT EQUAL: program counter jumps forward 2 instructions:used instead of label jumps
    rcall P1
    inc counter     ; increase counter

    cpi counter, 2        ; counter = 0
    brne PC+3    ; NOT EQUAL: program counter jumps forward 2 instructions:used instead of label jumps
    rcall P2
    inc counter     ; increase counter

    cpi counter, 3        ; counter = 0
    brne PC+3    ; NOT EQUAL: program counter jumps forward 2 instructions:used instead of label jumps
    rcall P3
    inc counter     ; increase counter

    cpi counter, 4        ; counter = 0
    brne PC+2    ; NOT EQUAL: program counter jumps forward 2 instructions:used instead of label jumps
    rcall P4

   

    ;******** counter clear and repeat****
    cpi counter, 4
    brne start
    clr counter
    rjmp start

/*ReleaseWait:
    sbis PINB, 1 ; PB1 released?
    rjmp ReleaseWait ; no, loop
    rcall DebounceDelay; insert delay
    rjmp start ;yes, loop back to start */

Wednesday, February 01, 2012

Unable to connect to SQL Server database. Role Provider

Unable to connect to SQL Server database. at System.Web.Administration.WebAdminPage.CallWebAdminHelperMethod(Boolean isMembership, String methodName, Object[] parameters, Type[] paramTypes) at ASP.security_roles_manageallroles_aspx.BindGrid() at ASP.security_roles_manageallroles_aspx.Page_Load() at System.Web.Util.CalliHelper.ArglessFunctionCaller(IntPtr fp, Object o) at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) at System.Web.UI.Control.OnLoad(EventArgs e) at System.Web.UI.Control.LoadRecursive() at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

 

in your web.config file for the ASP.NET site add this:

   <roleManager enabled="true" defaultProvider="SqlRoleProvider">
      <providers>
        <clear/>
        <add name="SqlRoleProvider" applicationName="eIPC" connectionStringName="Securityconn"
             type="System.Web.Security.SqlRoleProvider"/>
      </providers>
    </roleManager>
   
    <membership defaultProvider="SecuritySqlMembershipProvider">
      <providers>
        <!--Add a customized SqlMembershipProvider -->
        <add name="SecuritySqlMembershipProvider"
        type="System.Web.Security.SqlMembershipProvider"
        connectionStringName="Securityconn"
        enablePasswordRetrieval="false"
        enablePasswordReset="true"
        requiresQuestionAndAnswer="true"
        applicationName="appName"
        requiresUniqueEmail="true"
        passwordFormat="Hashed"
        maxInvalidPasswordAttempts="5"
        minRequiredPasswordLength="7"
        minRequiredNonalphanumericCharacters="1"
        passwordAttemptWindow="10"
        passwordStrengthRegularExpression=""/>
      </providers>
    </membership>

 

 

Good luck

Friday, August 26, 2011

Could not find default endpoint element that references contract

I received this error while adding a reference to a WCF service in a windows form application with multiple projects.


Error: Could not find default endpoint element that references contract '*' in the ServiceModel Client configuration section. This might be because no configuration file was found for your application, or because no endpoint element matching this contract could be found in the client element.

After hours of troubleshooting, I should have read the message more closely. This is basically saying the application cannot contact this service.  It gives 2 possible reasons why. One is that you did not include a configuration file which would be the app.config.  By default this created by the windows project templates. So it was there. The second reason is that there is not endpoint element in this XML file (app.config).

That was my problem. When you add a reference to a project using VS it will modify the app.config file and place this element in it automatically. As it turns out, when you have multiple projects in a solution and you add a reference to a project, VS will modify the app.config file of the project you are working in.  This may not be where the element needs to be placed if your solution has a different MAIN project or different startup project.  You will have to manually add this element to the app.config file that is the MAIN file for the solution.

Copy the following elements to the MAIN app.config file for your solution and you will be back on track.

Good Luck

<system.serviceModel>
    <bindings>
      <wsHttpBinding>
        <binding name="WSHttpBinding_ICFR" closeTimeout="00:01:00" openTimeout="00:01:00"
            receiveTimeout="00:10:00" sendTimeout="00:01:00" bypassProxyOnLocal="false"
            transactionFlow="false" hostNameComparisonMode="StrongWildcard"
            maxBufferPoolSize="524288" maxReceivedMessageSize="65536"
            messageEncoding="Text" textEncoding="utf-8" useDefaultWebProxy="true"
            allowCookies="false">
          <readerQuotas maxDepth="32" maxStringContentLength="8192" maxArrayLength="16384"
              maxBytesPerRead="4096" maxNameTableCharCount="16384" />
          <reliableSession ordered="true" inactivityTimeout="00:10:00"
              enabled="false" />
          <security mode="Message">
            <transport clientCredentialType="Windows" proxyCredentialType="None"
                realm="" />
            <message clientCredentialType="Windows" negotiateServiceCredential="true"
                algorithmSuite="Default" />
          </security>
        </binding>
      </wsHttpBinding>
    </bindings>
    <client>
      <endpoint address="http://localhost/SVC/CFR.svc"
          binding="wsHttpBinding" bindingConfiguration="WSHttpBinding_ICFR"
          contract="CFR_WCF.ICFR" name="WSHttpBinding_ICFR">
        <identity>
          <dns value="localhost" />
        </identity>
      </endpoint>
    </client>
  </system.serviceModel>

 

Wednesday, August 03, 2011

Get IP address of local computer C#

string m_sessionIp = "";

IPAddress[] localAddies = Dns.GetHostAddresses(Dns.GetHostName());

            //need to send the network address of the client computer. this could have multiple address with different versions(IPv4,IPv6)
            for (int i = 0; i < localAddies.Length; i++ )
            {
                if(localAddies[i].AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                {
                    m_sessionIp = localAddies[i].ToString();
                }
            }

 

Good Luck

* is a field but is used as a type

I ran into this when defining a web server class inquery and response.

 public partial class WebLogger : System.Web.UI.Page
    {
            LogToService srvs = new LogToService();
            LogTo inq = new SoapPW_LogTo.LogTo();

            Service_header header = new Service_header();
                                
            header.sessiontoken = stoken;
 }

The class usage must occur with a VIOD.  So change the code to this:

 public partial class WebLogger : System.Web.UI.Page
    {
            LogToService srvs = new LogToService();
            LogTo inq = new SoapPW_LogTo.LogTo();

            aires_header header = new aires_header();
                                
        protected void SetService()
        {

              header.sessiontoken = stoken;

        }
 }

That will do it.

 

Good luck

Friday, June 03, 2011

Interop type 'Microsoft.Office Interop Excel ApplicationClass' cannot be embedded. Use the applicable interface instead.

I experienced this when upgrading the project references from 3.5 to framework 4.0

change:

Microsoft.Office.Interop.Excel.ApplicationClass();
to
Microsoft.Office.Interop.Excel.Application();

good luck

Thursday, May 19, 2011

How to Avoid Using Cursors in MS SQL

This is for a MS SQL 2008 stored procedure.

The best way to avoid cursors with great performance is to use a WHILE LOOP.

This example is to simply iterate through a table. Start by selecting your collection and inserting it into a temporary table with an indexing row. Set a counter, a while loop and containers for your business logic.

CREATE TABLE #tmpTBL1(

    RowID int IDENTITY(1, 1),

    COL1 CHAR(1)

)

 

--ADD DATA

INSERT INTO #tmpTBL1 (COL1)

(SELECT SOMECOL FROM SOMETABLE)

 

-- define your containers

DECLARE @CHECKTHIS CHAR(1)

DECLARE @ROWCOUNT INT

DECLARE @COUNTER INT

 

-- SET THIS WHEN CHECKTHIS = Y FOR THE FIRST TIME, CLEAR AFTER CHECKTHIS = N

DECLARE @YN BIT

 

 SET @COUNTER = 1;

 SET @CHECKTHIS = '';

 SET @YN = 0;

 

    SELECT @ROWCOUNT = COUNT(*) FROM # tmpTBL1

   

    SELECT @CHECKTHIS = COL1 FROM # tmpTBL1 WHERE RowID = @COUNTER

   

    WHILE @COUNTER <= @ROWCOUNT

        BEGIN              

 

                     IF @CHECKTHIS = 'Y'

                           BEGIN

                                  SET @YN = 1

                           END

 

                     ELSE -- CHECKTHIS = N

                           BEGIN

                                  SET @YN = 0

                           END

 

            SET @COUNTER = @COUNTER + 1;

 

            SELECT @CHECKTHIS = COL1 FROM # tmpTBL1 WHERE RowID = @COUNTER

 

 

 

       END -- END THE WHILE LOOP

 

Good luck

 

Monday, May 16, 2011

The Value expression for the textrun ‘*’ uses an aggregate function with an expression that returned a data type not valid for the aggregate function.

[rsAggregateOfInvalidExpressionDataType] The Value expression for the textrun ‘*’ uses an aggregate function with an expression that returned a data type not valid for the aggregate function.

I recieved this error in SSRS 2008 R2.

Check your Syntax:

I had:

 =IIF(Count(Fields!column1,"DataSet1")=0,"No Data Found", "")

 

It should have been:

=IIF(Count(Fields!column1.Value,"DataSet1")=0,"No Data Found", "")

 

I set this as an expression in a textbox to show a No Data Found Message in a SSRS report.

 

Cheers!

 

Thursday, April 14, 2011

Could not load file or assembly '*' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

Could not load file or assembly '*' or one of its dependencies. This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded.

I got this when running a ASP.NET web application on Win Server 2008 64 bit.

To fix this error:

Check the application pool for the site.  Make sure it can run 32 bit applications. Set the value to true. 

Stop the IIS. Delete all the temporary ASP.NET files. They are usually located here:

C:\Windows\Microsoft.NET\Framework\v2.0.50727\Temporary ASP.NET Files

 Start IIS.

 

Check the Visual Studio Properties of the project.  Make sure the application is building a 32 bit assembly. Also check the target framework.  Do NOT set it to 4.0. Make sure it is between 2.0 and 3.5.

Build the VS proj.  Publish it to the Server.

 

If this does not work.  Call microsoft.

Thursday, March 10, 2011

SSRS Date Format

Make sure the type in the stored procedure is DateTime or in the sql select. You may cast a string with:

cast(COLUMN, as DateTime)

 

Once the select retruns Type DateTime, then select the textbox properties > number > Date > date format

 

Otherwise you can try this on the textbox:

=Format(CDate(Fields!A.Value), "MMMM yyyy")

 

good luck

 

Wednesday, February 23, 2011

Server Error in '/' Application. Could not load file or assembly '*' or one of its dependencies

Server Error in '/' Application. Could not load file or assembly 'pdflib_dotnet' or one of its dependencies. An attempt was made to load a program with an incorrect format.

 

I got this error when deploying a 32 bit web application to a windows server 2008 R2 64, IIS7.0.

 

The application pool is not set to run 32 bit applications. Open IIS manager, select the application pool for the site and modify the advanced settings.  Change the "Enable 32 bit Applications" property to TRUE.

open a cmd

type > iisreset

The site should restart. Retest your application and this should work.

 

cheers

 

Friday, February 18, 2011

pass parameter to ssrs report

Say you have a SSRS report located here:

http://servername/Reports/Pages/Report.aspx?ItemPath=%2fXXXX%2freportname

 

And you need to pass parameters to it from another application/webpage. The trick is to send it to a different snytax or location and SSRS will do the work.

 

Send to Here:

http://servername/ReportServer/?%2fXXXX%2freportname&rs:Command=Render&rc:Parameters=false&parameter=W&UserIdDomain=SLove&Domain=socalmp

 

This applies to SSRS 2008 R2.

 

cheers

 

steve

 

 

Wednesday, October 29, 2008

Parameter name: UltraGridDesignerDialog constructor - null grid parameter!

The references became corrupted some how and this caused the license.licx file to become corrupted.

So, what fixed it for me was dropping my references, deleting my entire bin directory, re-adding the references, and recompile.

Finally, make sure that the CopyLocal property of the Infragistics assembly reference is set to false.

 

Wednesday, October 15, 2008

Masked TextBox

Here are some important characters for custom masks:

 

Character Mask value

0 (zero)

Required digit

9

Optional digit

A

Required alphanumeric

a

Optional alphanumeric

&

Required Unicode character

C

Optional Unicode character

#

Optional digit or space, or plus or minus symbol

L

Required letter (a-z, A-Z)

?

Optional letter

. (period)

Decimal place holder

, (comma)

Thousands place holder

$

Currency symbol

: (colon)

Separate time values

/ (forward slash)

Separate date values

< (less than)

Force to lower case

> (greater than)

Force to upper case

 

 

good luck

Thursday, June 19, 2008

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

An error has occurred while establishing a connection to the server.  When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

 

For some Reason I needed to add this to my connection string in the web.config file.

<remove name="LocalSqlServer"/>
        <add name="LocalSqlServer" connectionString="Server=servername Database=dbname; User ID=user; Password=something; Trusted_Connection=False" providerName="System.Data.SqlClient"/>
               

so the whole entry looks like this:

<connectionStrings>
        <add name="ClubSiteDB" connectionString="Server=servername; Database=dbname; User ID=user; Password=password123; Trusted_Connection=False" providerName="System.Data.SqlClient"/>
 <remove name="LocalSqlServer"/>
        <add name="LocalSqlServer" connectionString="Server=servername Database=dbname; User ID=user; Password=something; Trusted_Connection=False" providerName="System.Data.SqlClient"/>
               
    </connectionStrings>

 

Please support this blog by clicking on the advertisments to the right.

Invalid object name 'SiteSettings'.

I got this error when I was installing the ClubSite starter Kit on Godaddy's servers.

The Table is not created in the Database when the .sql script is run.

 

Run this in your query analyzer.

 

CREATE TABLE [dbo].[SiteSettings](
    [SiteID] [int] IDENTITY(1,1) NOT NULL,
    [SiteName] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [Theme] [int] NULL,
 CONSTRAINT [PK_SiteSettings] PRIMARY KEY CLUSTERED
(
    [SiteID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

 

 

You'll probable need this one also

CREATE TABLE [dbo].[SiteThemes](
    [Theme] [nvarchar](50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL,
    [ThemeID] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_SiteThemes] PRIMARY KEY CLUSTERED
(
    [ThemeID] ASC
)WITH (PAD_INDEX  = OFF, IGNORE_DUP_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]

 

 

Please support this blog by click on the advertisements to the right.

Thursday, May 22, 2008

System.Deployment. Application. Deployment Download Exception (Unknown subtype)


1). All you have to do is to add the 

.manifest = application/manifest 

and

.deploy=application/octet-stream 

in the IIS root directory's -> Properties -> HTTP Headers -> MIME Types.

RightClick the Default Web Site of your IIS , then Select Properties, then go the HTTP Header tab. Near the bottom of the tab there is a command button called MIME Types 

Click the MIME Types button. A New dialog pops. This dialog show you the MIME Types that are registered with your server. Click the New button 

on this dialog.  Another dialog pops that has two text boxes.

That asks you the Extension and MIME Type
---------------------------------------------------------------------

Like:        Extension
               MIME Type

---------------------------------------------------------------------

First  add the Extension to .manifest and add MIME Type to 

application/manifest 
Then add the Extension to .deploy   and  add MIME Type to 

application/octet-stream

Saturday, May 17, 2008

An expression of non-boolean type specified in a context where a condition is expected, near ')'

This is an syntax error in SQL when the 'if' statement is not correctly formatted.

In SQL an 'if' statement in a stored procedure can look like this:

 

IF  'condition'

BEGIN

'statement'

END

 

When the conditional statement is not formattted correctly you'll get the error for example I had:

IF  @variable = 'ALL' OR ' '

BEGIN

set @variable = NULL

END

 

I am checking the value of the incoming parameter and changing it to NULL. I do this to avoid dynamic SQL in my where clause.  But this is another topic.

SO

Change the if statement to this and avoid my mistake:

IF  @variable = 'ALL' OR @variable = ' '

BEGIN

set @variable = NULL

END

 

Please support this blog by clicking on my sponsors to the right.

 

Good Luck!

arrowContact Us