Skip to content

Database

Discussions on database access, SQL, and ADO

This category can be followed from the open social web via the handle database@forum.codeproject.com

17.1k Topics 61.8k Posts
  • plz brack my licence

    help
    2
    0 Votes
    2 Posts
    0 Views
    M
    What does brack mean? Do you mean break? Never underestimate the power of human stupidity RAH
  • Oracle Collection Objects

    database oracle xml question
    6
    0 Votes
    6 Posts
    0 Views
    W
    Not directly. If you're using output cursors, you pass the cursor to the caller at the end but the cursor is based on a query from an object. I know that you can create a cursor based on a nested table but I have never tried that with associative arrays or varrays. The need to optimize rises from a bad design.My articles[^]
  • SQL bit to bool conversion [moved]

    question database data-structures tutorial
    14
    0 Votes
    14 Posts
    0 Views
    L
    You need to spend some time with your debugger to figure out exactly where this is going wrong and why. Check all the possible values in your objects at each stage, in particular check whether gridviewrow.cells[1] actually has a text value that can be returned. Unrequited desire is character building. OriginalGriff
  • Check Different Select query result

    database
    15
    0 Votes
    15 Posts
    0 Views
    P
    I don't know your data but you could try to get all your counts in one go using a CASE WHEN. The COUNT aggregates only non null values. SELECT @result1 = COUNT(CASE WHEN (isNull(TDR_D20,0)= 0 And isNull(TDR_D40,0)=0 ...) THEN 1 ELSE NULL END), @result2 = COUNT(CASE WHEN (isNull(TDR_D20,0)>0 Or isNull(TDR_H20,0)>0 ...) THEN 1 ELSE NULL END), @result3 = COUNT(CASE WHEN (isNull(TDR_D20,0)=0 AND isNull(TDR_H20,0)=0 ...)) THEN 1 ELSE NULL END) FROM table WHERE Vessel_Code=@Vsl AND Voyage_No=@Voy AND POL=@POL This would be efficient as you would only read your table once this way. Then the logic you can probably remove quite a bit of the begin end and it becomes (sometime) clearer. IF @result1 = 20 SET @Color='Red Color' Else IF @result2=20 SET @Color='Blue Color' Else IF @result3>0 SET @Color='Blue Color' Else IF @result4>0 SET @Color='Blue Color' Else IF @result5=20 SET @Color='Green Color' Else IF @result6>0 SET @Color='Yellow Color' Else @Color='Orange Color'
  • Inner Query in mysql

    database mysql question
    7
    0 Votes
    7 Posts
    0 Views
    R
    Thanks dear....You are probably right but there is something more.......Look at my Example proper and told that is possible or not in MySql
  • DB2: Create primary key on partition table?

    question csharp mcp cryptography tutorial
    5
    0 Votes
    5 Posts
    0 Views
    C
    ok, thanks MCP.NET, MCAD.NET, MCSD.NET
  • Local Variable Ntext Probelm sql 2005

    help database
    2
    0 Votes
    2 Posts
    0 Views
    W
    You already asked this question over here: Local Variable Ntext Probelm[^]. Don't post the same question multiple times on different forums. The need to optimize rises from a bad design.My articles[^]
  • Dynamic Query Question

    question database help
    16
    0 Votes
    16 Posts
    0 Views
    S
    PIEBALDconsult wrote: They are rarely the right tool for the job. No other tool suits the needs, :). I don't disagree with you sediments. However, in my world its all that exists. Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • Temp and variable table cannot be created.

    database sql-server sharepoint com sysadmin
    5
    0 Votes
    5 Posts
    0 Views
    S
    nbgangsta wrote: My SP uses a temp table since it uses nestes SP's. Where is the temp table being created at? nbgangsta wrote: the moment I close it the temp table gets dropped. That is how temp tables work, as soon as the process that created the temp table completes and returns (exits scope) all temporary objects such as temp tables and variables get cleaned up (ie dropped) What are you trying to accomplish with the temp table? Return results to the SSIS package? I am guessing here that you are looking to parse the results of the stored proceedures in the SSIS package. -> In your SSIS pacakge -> Execute SQL Task -> General tab, Change ResultSet to 'Full Result Set' -> Result Set tab, 'Result Name' = 0 and 'Variable Name' = User::User_Defined (Variable of type object) -> Change stored proceedure ALTER PROCEDURE test ... -- Create a temp table to house the run info of the procs -- CREATE TABLE #Results(msg VARCHAR(200), LogTime SMALLDATETIME DEFAULT GETDATE()) -- Start time -- INSERT INTO #Results ("Start first child proc") -- Execute the stored proc EXEC sp_Test_First_Child_Proc -- Completion Time -- INSERT INTO #Results ("Completed first child proc") -- Start time -- INSERT INTO #Results ("Start second child proc") -- Execute the stored proc EXEC sp_Test_Second_Child_Proc -- Completion Time -- INSERT INTO #Results ("Completed second child proc") -- Ect. ... -- Select the results from the temp table, this will return the result back to the SSIS package -- -- This is the important step, if you dont as a last step select the results out for return then SSIS will never the them and when the proceedure completes the #Results table will be dropped automaticly -- SELECT msg, LogTime FROM #Results Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • Single row for multiple results

    tutorial
    14
    0 Votes
    14 Posts
    1 Views
    S
    Without knowing the stucture of your tables it's kinda hard to say, but one approach could be to pivot the data into a temp table. Then you can maniulate the results as needed. http://blog.sqlauthority.com/2008/06/07/sql-server-pivot-and-unpivot-table-examples/[^] Common sense is admitting there is cause and effect and that you can exert some control over what you understand.
  • Cube processing confirmation?

    question
    3
    0 Votes
    3 Posts
    0 Views
    S
    current1999 wrote: After processing your ETL package which loads data into the cube, how do you ensure that your cube has been processed? Well it depends on what you are looking for in confirmation. 1: Confirmation of last successful processing 1.1: If the SQL Server agent is processing your cubes, then you can set the agent up to send out an email on completion. This will tell you if the process completed successfully or failed. The only caveat is if you run the job as a SQL Server Analysis command, then the agent wont know if the command failed or was successful. Just make sure to run your commands as a SSIS package and there wont be any issues. 1.2: In addition to agent notifications I use a modified version of the Microsoft SSAS example, AMO Display Object Names. I modified it to read the structure and send me an email with last processing date / times of the cubes and dimensions. Info: http://technet.microsoft.com/en-us/library/ms160876(SQL.90).aspx Had to remove some of the code as it contained company info in it, but here is the juxed of it try { //-------------------------------------------------------------------------------- // For each database on the server, we'll display its name and other objects names. //-------------------------------------------------------------------------------- foreach (Database db in server.Databases) { Console.WriteLine("{0}", db.Name); // Display Dimensions Console.WriteLine("\\tDimensions:"); foreach (Dimension dimension in db.Dimensions) Console.WriteLine("\\t\\t{0}", dimension.Name); // Display Cubes Console.WriteLine("\\tCubes:"); foreach (Cube cube in db.Cubes) { Console.WriteLine("\\t\\t{0}", cube.Name); // Display Measure Groups Console.WriteLine("\\t\\tMeasure Groups:"); foreach (MeasureGroup group in cube.MeasureGroups) {/\*\*/
  • See this

    csharp com question
    1
    0 Votes
    1 Posts
    0 Views
    No one has replied
  • Compare 3columns from a row with data Null value

    database tutorial question
    4
    0 Votes
    4 Posts
    0 Views
    N
    Many Thanks to Mycroft Holmes and Sujit0761 Both answer are work in order.
  • HELP !!

    database help question
    2
    0 Votes
    2 Posts
    0 Views
    L
    First of all, don't start a topic with some generic topic like "help". I had to click on it and read it to determine it's contents - something I don't do when there's not much time. People could have an easy answer and skip your question, simply because the topic doesn't provide any clue. Most people posting questions here on the boards are looking for help in one way or the other. On to your problem; there are some free dictionaries here[^], but I never seen them and can't say much about them. Ergane[^] has it's dictionaries available as a separate download. Last alternative, you can download the wiktionary[^]. Good luck :) Bastard Programmer from Hell :suss:
  • Displaying SSRS Reports

    sql-server sysadmin security question
    10
    0 Votes
    10 Posts
    0 Views
    P
    I agree Chris..this was just to show how impersonation can be done using Forms authentication. This section can be easily encrypted using one of these methods: http://msdn.microsoft.com/en-us/library/zhhddkxy.aspx[^] Thanks for raising the point tough... with kudos, Pradeep
  • 0 Votes
    2 Posts
    0 Views
    L
    What database is it? If it is SQL Server 2008, you should use nvarchar(max) instead of ntext. Most string functions cannot work with ntext. EDIT: As a workaround, you can do this: Select Data = CAST(ltrim(rtrim(CAST(@RowData AS nvarchar(max))) AS ntext) modified on Monday, August 8, 2011 11:45 AM
  • sql command error [modified]

    database help tutorial
    11
    0 Votes
    11 Posts
    11 Views
    P
    I thought I was being facetious in my over-engineering way. :-D
  • 0 Votes
    3 Posts
    0 Views
    J
    Hi Yes, I have searched this topic with google. But I have not found usable solution. If You check those google results and if You find something useful, could You then send notification :) jtpaa
  • How to get all reference of a column in a database.

    database tutorial
    7
    0 Votes
    7 Posts
    0 Views
    D
    Thnks all finally i got.
  • mysql SELECT WHERE

    database php mysql question lounge
    10
    0 Votes
    10 Posts
    1 Views
    N
    Further to Luc's excellent advice, I would add that you should avoid the death trap SELECT * FROM ... syntax. It's quick now but will come back and bite your head off in the future. Name the columns you want explicitly and query nothing else. Panic, Chaos, Destruction. My work here is done. Drink. Get drunk. Fall over - P O'H OK, I will win to day or my name isn't Ethel Crudacre! - DD Ethel Crudacre I cannot live by bread alone. Bacon and ketchup are needed as well. - Trollslayer Have a bit more patience with newbies. Of course some of them act dumb - they're often *students*, for heaven's sake - Terry Pratchett