Forum Replies Created

Viewing 15 posts - 31 through 45 (of 66 total)

  • RE: Query to pick columns from multiple tables

    You are quite right. I am learning something small or big everyday. I was in the middle of inventing SQL crosstab reports tools. And I came up with the lengthy solution....

  • RE: need help from all DBAs and developers

    As I do not have your full detail and sample data of the tables, I have to guess.

    select PinPackages.PackageName [Package],

    CONVERT(VARCHAR(25),TransactionDate,101) As [SaleDate],

    datepart(hh,TransactionDate) As [MilitaryTime],

    Count(*) As [Count] --

  • RE: Query to pick columns from multiple tables

    You need cross-tab query and a temp table as follows:

    SET NOCOUNT ON

    -- Drop tables if alraedy exist

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Table1]') and OBJECTPROPERTY(id, N'IsUserTable') =...

  • RE: need help from all DBAs and developers

    You already have the clue in your SQL:

    select PinPackages.PackageName,

    datepart(hh,TransactionDate) As [MilitaryTime],

    Count(*) As [Count]

    FROM dbo.Suppliers INNER JOIN

    dbo.Batches ON dbo.Suppliers.SupplierID = dbo.Batches.SupplierID INNER JOIN

    dbo.PinPackages ON dbo.Suppliers.SupplierID = dbo.PinPackages.SupplierID INNER JOIN

    dbo.Pins...

  • RE: Update Query works in Query Analyzer, but not from ASP page

    Check if you have UPDATE permission on myTable. I cannot think of anything else.

  • RE: count problem - ???

    Sorry, I missed count.

    Use this script to include count:

    SET NOCOUNT ON

    -- Drop tables if alraedy exist

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Course]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop...

  • RE: count problem - ???

    You need cross-tab query which SQL does not provide yet. You need to create script as below:

    SET NOCOUNT ON

    -- Drop tables if alraedy exist

    if exists (select * from dbo.sysobjects where...

  • RE: Persist changed global variable

    I understand now clearly. You may save the package at the end of the package execution by adding an ActiveX Script Task as below.

    Function Main()

    Dim oPkg

     Set oPkg = DTSGlobalVariables.Parent

     oPkg.SaveToSQLServer "Server",...

  • RE: Changing Flat File Destinations

    This is 3 step process as follows:

    1. Create a Global Variable "FilePath".
    2. Create an ActiveX Script Task as below:

    Function Main()

     ' Initialise variables first

     DTSGlobalVariables("FilePath").Value = "\\Server\Directory\FileName." & CStr(Year(Date)) & Right("0" & CStr(Month(Date)),...

  • RE: Switching Between Worksheets in an Excel Source

    I thought I could replace the Excel table name dynamically using Global Variable but Excel syntax is different from SQL syntax. So I failed to deliver which could have been...

  • RE: bestway to combine column values

    Sorry, you need this script for table and data population:

    -- Create table [TestItem]

    if exists (select * from dbo.sysobjects where id = object_id(N'[TestItem]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [TestItem]

    Create Table...

  • RE: bestway to combine column values

    This is something like cross-tab report technique. Do try script below:

    DECLARE @Col1 Varchar(50)

    DECLARE @SQL Varchar(5000)

    DECLARE @Num INT

    DECLARE Fields CURSOR FAST_FORWARD FOR

    SELECT Col1 FROM TestItem

    GROUP BY Col1

    ORDER BY Col1

    SET @SQL =...

  • RE: Persist changed global variable

    Hi, I am not too certain if I understand when you say "when I run it from the designer and save the package, the value saves".

    Do you mean the value is...

  • RE: Cursors in Stored proc

    You must provide more information which will include

    1. Create table tblSample ([ID] INT Not NULL, Var1 Varchar(50) Not Null, etc.....)
    2. Insert Into tblSample SELECT 1,'test1',...
    3. Your requirements including why you want to use...
  • RE: Dynamic Median calculations

    Try this:

    --

    SET NOCOUNT ON

    -- Create Temp Tables

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Detail]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)

    drop table [dbo].[Detail]

    Create Table [dbo].Detail

    (PATIENT varchar(50) NULL, WARDNAME varchar(50) NULL,...

Viewing 15 posts - 31 through 45 (of 66 total)