29 How to write dynamic query in stored procedure

แชร์
ฝัง
  • เผยแพร่เมื่อ 28 ม.ค. 2025

ความคิดเห็น • 17

  • @kgranite6595
    @kgranite6595 2 ปีที่แล้ว +1

    Thank you! This is the most practical lesson. I really appreciate it!

    • @learnssis
      @learnssis  2 ปีที่แล้ว

      You are most welcome k granite.

  • @mokshanimma4787
    @mokshanimma4787 2 ปีที่แล้ว +2

    Hi sir, could you please make video on finding long running queries and optimising or tuning complex queries. These will be helpful while attending interviews. Thanks in advance.

    • @learnssis
      @learnssis  2 ปีที่แล้ว +1

      Okay, I will try to make videos on these topics.

  • @shivarajkumar6270
    @shivarajkumar6270 2 ปีที่แล้ว

    Performance tuning techniques in sql server?

    • @learnssis
      @learnssis  2 ปีที่แล้ว

      Yeah its a pending topic and will try to make a video on it, recently I made 2 videos on performance tuning of SSIS packages, I would recommend you to take a look on them as well
      th-cam.com/video/3pacxWeTce4/w-d-xo.html
      th-cam.com/video/7sKEgm2uQEM/w-d-xo.html

  • @MovieTime-tg2mn
    @MovieTime-tg2mn ปีที่แล้ว

    Hi Bro,
    Could you please Help How to write a stored procedure for creating multiple new table with columns by passing input parameter in dynamic SQL, Thanks in Advance

    • @learnssis
      @learnssis  ปีที่แล้ว

      This is the stored procedure
      CREATE PROCEDURE CreateSingleTable
      @TableName NVARCHAR(100),
      @Column1Name NVARCHAR(100),
      @Column1Type NVARCHAR(100),
      @Column2Name NVARCHAR(100),
      @Column2Type NVARCHAR(100)
      AS
      BEGIN
      SET NOCOUNT ON;
      DECLARE @SQL NVARCHAR(MAX)
      SET @SQL = 'CREATE TABLE ' + @TableName + ' (' +
      @Column1Name + ' ' + @Column1Type + ',' +
      @Column2Name + ' ' + @Column2Type + ');'
      EXEC sp_executesql @SQL
      END;
      ---------------
      And this is how you can call it
      EXEC CreateSingleTable
      @TableName = 'MyTable',
      @Column1Name = 'ID',
      @Column1Type = 'INT',
      @Column2Name = 'Name',
      @Column2Type = 'VARCHAR(50)';

    • @MovieTime-tg2mn
      @MovieTime-tg2mn ปีที่แล้ว

      Thanks Bro@@learnssis

  • @doddapanenisatish6475
    @doddapanenisatish6475 2 ปีที่แล้ว

    how to run. Sql file through stored procedure and replace name with output file. log

    • @learnssis
      @learnssis  2 ปีที่แล้ว

      I got your first question "how to run sql file through stored procedure" but did not get the second one "and replace name with output file log"

  • @Knowledgegreenone
    @Knowledgegreenone 2 ปีที่แล้ว

    Nice can u give more example on dynamic query

    • @learnssis
      @learnssis  2 ปีที่แล้ว

      Sure I can give more examples of it.

  • @sonyguptaagrawal6028
    @sonyguptaagrawal6028 ปีที่แล้ว

    please teach from start ,how to write dynamic sql query

    • @learnssis
      @learnssis  ปีที่แล้ว

      Thanks Sony Gupta for your suggestion, I am trying to make videos on all topics on SQL Server, will cover this topic in detail.

  • @learner_SSIS
    @learner_SSIS 2 ปีที่แล้ว

    Thank you Aqil sir 😀

    • @learnssis
      @learnssis  2 ปีที่แล้ว

      You are most welcome Naveen.