Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
D

David Mujica

@David Mujica
About
Posts
895
Topics
44
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Fetch row and display in frontend column
    D David Mujica

    Are you talking about fetching a column of data and displaying it as a single row? SQL Server has an interesting command that can do that. STRING_AGG (Transact-SQL) - SQL Server | Microsoft Learn[^]

    Database question database

  • ORDER BY in UNION
    D David Mujica

    I know this is not going to be a popular opinion, but ... 1) Create a #TEMP table 2) Insert into the table with part 1 of the query 3) Insert into the table with part 2 (sorted) Return the dataset from the #TEMP table

    Database database sql-server sysadmin question

  • what is visual basic used for
    D David Mujica

    Currently I use VB for 1) Windows services - Processing file messages into database transactions 2) Schedule data extractions - Monthly SQL extracts, reports, Excel, etc Anything that requires a User Interface, I develop a Web Application, anything that requires background execution I develop in VB. :java:

    Visual Basic java question

  • execute an update  using --> "Exec sp_executesql @Sql1"
    D David Mujica

    How is the @Sql1 variable defined ? Ex: Declare @Sql1 Varchar(200)

    Database help tools question announcement

  • Get Process Percentage
    D David Mujica

    How about this approach ... 1) Run the process as a test, collecting the total time it takes. Call it "T" 2) Store that run time somewhere 3) Next time you run the process you can now use "T" as the denominator to calculate the percent complete. p = duration_now/T 4) If the percentage calculation goes over 100, then set it 100. 5) Capture the new total time, "T", store it for the next iteration. Rinse, repeat. Not perfect, but it might work for you. :java:

    Visual Basic tutorial question

  • Best practice for creating a limited access ms-sql user ?
    D David Mujica

    Given: 1) Developing a WebService on a DMZ server which will connect back to corporate SQL2019 server. 2) There are lots of other databases on this server, however there will be only one database (DB_X) which these WebServices need to interact. 3) Assume user, WEBAPI_USER, is created. Also executed: DENY VIEW ANY DATABASE TO WEBAPI_USER; 4) Now, that user cannot see any databases via MS SQL Server Studio, not even the DB_X database which has been granted access Note: Kind of crazy because if you run the query: SELECT * FROM SYSOBJECTS WHERE XTYPE = 'U', you will get a full list of all the tables. If done some research on this and it appears that WEBAPI_USER would need to become the owner of the databaase to see it in MSSS. Question: What is everyone else doing to create a limited access MS-SQL user ? Thank you in advance. David

    Database database question sql-server sysadmin discussion

  • Connecting DB tables
    D David Mujica

    Post your SQL code and table definitions and you should get some help here.

    Database question database regex json

  • I am having problem creating a script to monitor Rest/API services.
    D David Mujica

    I see a few problems with your code: 1) Looks like your main() does not call your ServerStatusBy() function 2) You are not reading any values from the command line. Here is a VB example:

    Sub Main()
    Dim args() As String = System.Environment.GetCommandLineArgs()
    Dim s As String

        For i As Integer = 0 To args.Length - 1
            Console.WriteLine(String.Format("Arg {0}): {1} ", i, args(i)))
        Next
    
        s = Console.ReadLine
    
    End Sub
    

    When you run the program from a command prompt like HellowWorld.exe www.google.com jdoe@companyabc.com The output is as follows: Arg 0): C:\_WorkingCopies\HelloWorld\HelloWorld\bin\Debug\HelloWorld.vshost.exe Arg 1): www.google.com Arg 2): jdoe@companyabc.com You can see that you want to grab Arg(1) as the URL and Arg(2) as the email address you want to send the report.

    ASP.NET csharp json com sysadmin

  • I am having problem creating a script to monitor Rest/API services.
    D David Mujica

    Just a thought; what if you pass the URL as a command line argument ? This way the program is agnostic to which server it is checking. You could also pass the email addresses on the command line.

    ASP.NET csharp json com sysadmin

  • Sandwich Query For Employee Attendance using SQL Server 2005
    D David Mujica

    A few SQL functions may be of help for you .. Take a look at this query

    SELECT *,DATEPART(wk, AttDate) As 'Week Number',DATEPART(weekday, AttDate) As 'Week Day', DATENAME(WEEKDAY,ATTDATE) FROM #TEMP1

    Database database sql-server sysadmin

  • Import Excel sheet into Gridview and SQL
    D David Mujica

    Here is something that I use in my web app ... 1) Define a connection string pointing to the Excel file

    String.Format("Provider=Microsoft.ACE.OLEDB.12.0; Data Source = {0}; Extended Properties='Excel 12.0; HDR=Yes; IMEX=1;'", sFilename)

    1. You can access some schema information from the Excel doc like this ...

    DTschema = dbConn.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, Nothing)

    1. Then get to the actual data in the spreadsheet like this ...

    Using dbCmd As New OleDbCommand("SELECT * FROM [" & sSheet & "]", dbConn)
    Using dbAdapter As New OleDbDataAdapter(dbCmd)
    dbAdapter.Fill(DT)
    End Using

    It may not be pretty, but you get the data from the spreadsheet into a datatable which can then be bound to a Gridview. See if it works for you. :thumbsup:

    Web Development csharp database visual-studio algorithms

  • Database scripts version control process/strategy?
    D David Mujica

    One way to approach this is to have a create a baseline set of scripts which created all of your DB objects: Tables, Indexes, Triggers, Stored Proc, etc. Check those scripts into a version control system () along with your source code. (Make a folder called "SQL" or something) As you revise your application, create ALTER scripts for the DB objects (Tables, Indexes, Triggers, Stored Proc, etc) which will take the database from State A to State B. Use some type of naming convention which will show the progress from one version to another. "ALTER_tables_1.0.0_to_1.0.1" When you get to a major release of the software, such as v2.0.0, then Re-Create the CREATE DB object scripts which will include all of your ALTER scripts; this way you don't have to keep rolling up schema changes. ALSO: Take into consideration that you may need Data Manipulation scripts to "seed" some of your tables with basic data. Handle those scripts with something like ALTER_Data_1.0.0_to_1.0.1 Just giving you some ideas, not completely thought out, but I remember doing something like on previous projects. BTW: I use Subversion / SVN / Tortoise as version control for myself.

    Database database collaboration question announcement

  • Dead lock issue with Update and delete statement on the same table
    D David Mujica

    If you are using SQL server and the DELETE operation can be delayed or postponed try this approach … Use an application lock to synchronize two different processes that data is being manipulated and try again later ... Microsoft has sp_getapplock Maybe it would work for you.

    Database help announcement

  • Generating unique user ID
    D David Mujica

    Consider implementing a Sequence table like: SequenceName, NextID The table will consist of a single row such as UserID, 2083928937 This way you immediately know what the next UserID is. Within a transaction, create the User, then update the sequence table by 1. :java:

    ASP.NET question database com regex help

  • pls help
    D David Mujica

    If you run your application on the WebServer where it is hosted, you may get more detail about the error without having to do anything else. Try to RDC (Remote Desktop Connection) to that server. :java:

    ASP.NET help sysadmin

  • Sql server deadlock issue with table bulk insert and update on same table
    D David Mujica

    If you are using a script to initiate the bulk load, at the end of the script start the process for updating. That is a simple way of synchronizing the processes. :java:

    Database database sql-server sysadmin collaboration help

  • Updater for multi-user program
    D David Mujica

    I think what you need to research is the topic of concurrency. One way to implement this is to have a Modify Date on the primary record. 1) Read the table entry along with the modify date/time. 2) When updating the database, compare the original date/time with the value currently stored, if the date/time has not been changed, then it is OK to perform your update. (Rollback) During your update you would set the modify date/time to the current date/time. (GetDate() ) Something like that.

    Visual Basic database help tutorial announcement

  • Reporting data
    D David Mujica

    What database are you using? If it is MS-SQL, then there is a command call PIVOT which will do exactly what you want to do. :java:

    Database question php database com sales

  • Developing a Restaurant Billing System
    D David Mujica

    Are you going to integrate it with your kitchen and bar ? Once the order is taken, it should notify the kitchen and bar. When the server picks up the order, it should perform a timestamp on pickup so you can see how long an order takes to process. Just a thought. :java:

    Visual Basic sysadmin question mobile database sql-server

  • Create a new Primary Key on survey table
    D David Mujica

    Can you explain what these columns are ? Looks like you have enough data to make a primary key, but understanding the data would lead to a suggestion. :java:

    Database database question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups