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.

T-SQL: Ergebnis einer function in Variable schreiben

Empfohlene Antworten

Veröffentlicht

Hi,

ich stehe vor folgendem Problem: in einer View möchte ich das Ergebnis einer T-SQL - Function nutzen, diese muss allerdings unter umständen rekursiv eine Hierarchie durchgehen. Ich muss das Ergebnis der Function - wenn ich nicht am Root-Element der Hierarchie ansetze - also erstmal in eine Variable schreiben. Hier hänge ich momentan mit folgendem Ansatz:

@IsValid = EXEC dbo.fn_IsObjectValid (SELECT TOP 1 FK_Standort FROM dbo.TB_StandortBereich WHERE PK_StandortBereich = @ObjektPK), 1, @MitarbeiterPK

Das zweite Problem ist, dass mir das Management Studio einen Fehler bei einem Komma meldet. Ich vermute, dass ich das Subselect nicht direkt nutzen kann, aber so ganz sicher bin ich mir noch nicht.

Vielen Dank schonmal für die Hilfe

small-step

Danke für die vielen Zuschriften, ich hab's mittlerweile selbst gelöst.

aus

@IsValid = 

EXEC dbo.fn_IsObjectValid (

SELECT TOP 1 FK_Standort 

FROM dbo.TB_StandortBereich 

WHERE PK_StandortBereich = @ObjektPK

), 1, @MitarbeiterPK
wird
@IsValid = (

SELECT dbo.IsObjectValid(

(SELECT TOP 1 FK_Standort 

FROM dbo.TB_StandortBereich 

WHERE PK_StandortBereich = @ObjektPK

), 1, @MitarbeiterPK)

)

oder so ähnlich. Sieht bei mir noch ein wenig anders aus, da ich noch ein case und einiges anderes drumrum habe.

Gruß,

small-step

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.