Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

MSSQL SP: Where Bedingung gemäß Parameterinhalte zusammenstellen

Empfohlene Antworten

Veröffentlicht

Hallo zusammen,

ich möchte in meinem Stored Procedure Abfragen ob ein Paremeter leer ist. Ist dies der Fall, dann soll er in der Where Bedingung nicht auftachen ansonsten schon.

Wie kann ich des realisieren?

Danke

Ciao

Antibiotik

annähernd so (hab hier keinen sql server :D):

CREATE PROCEDURE spMeineBlablaProc(@Bedingung int)

AS

BEGIN

DECLARE @Bedingung int;  

DECLARE @SQL varchar(1000);


SET @SQL = 'SELECT bla FROM foo '


IF @Bedingung IS NULL

 SET @SQL = @SQL + 'WHERE blibla'


IF @Bedingung IS NOT NULL

 SET @SQL = @SQL + 'WHERE tritra'


EXEC(@SQL)

s'Amstel

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.