Tag: database

How to update a value in local SQL Server database

In my program I want the user to have the option to change the value (price in my example) in a local database, that I created. I’m having a problem with it. The connection works fine and it debugs well and even shows the message that “saving ok”, but it doesn’t change at all in […]

Left Outer Join Query Extremely Slow – SQL Server

Huge issue with an SQL Server Query! So the query below utilizes JOIN commands in the query, but takes no less than 15-20 minutes to run! No idea how to better optimize this code 🙁 Any ideas on how to fix this issue? SELECT dbo.DB_Timetrack.[JOB #], dbo.DB_Timetrack.[Last Name], dbo.DB_Timetrack.[First Name], dbo.DB_Timetrack.HOURS, dbo.DB_Timetrack.BEGDATE, dbo.DB_Timetrack.LOCATNID, dbo.DB_Timetrack.DESCR, dbo.DB_Timetrack.CODE, […]

TFS / SSDT Deployment in Multi Environment Scenario

This is the scenario I am currently experiencing. In Development environment, developers usually make changes in the DEV SQL Server, then they will do a schema compare in Visual Studio 2013 / TFS, update the TFS then check the changes in. Now, say in DEV, there are many stored procedures in a database that refer […]

Dynamic attributes for a model

I’m currently creating a document management system where the user should be able to configure the supported document types and therefor the documents attributes. My current conceptional ERD for the template looks like this: but if i would like store my documents in this way, i it would create for each document with 2 attributes […]

Add multiple SQL values with same parameterized query?

I’m fairly new to SQL and trying to figure out the best way to add some predefined data. I figured out from searching around here that I should used a parameterized command to avoid a sql injection attack which isn’t a huge concern in this case but I would like to avoid the possibility and […]

Need assistance with a SQL query

I need help with a query that I can’t seem to figure out how to compose. (SQL Server) I have two tables, “Project” and “ProjectStatus” that have these fields: (I have omitted irrelevant columns) Project PROJID (PK) NAME ProjectStatus STATUSID PROJID (FK, references projid in project table) CHANGEDDATE I want to get a list of […]

SQL auto-create a value column

I have a table in a SQL Server database with columns E-mail, Mobile Number, AuthCode, UserID. When I add a new user, the AuthCode column should be filled with a value like this: UserID+Mobile Number. Like this: if new user has a mobile number of 05518602015 and UserID (Autoincrement) of 2, then the AuthCode column […]

sql select and group by CURRENT_TIMESTAMP

I’m trying to select and group by date from MySQL. table looks like this: `id` int(11) NOT NULL, `run_data` datetime NOT NULL DEFAULT CURRENT_TIMESTAMP, `date_day` varchar(20) NOT NULL, `number_of_links` int(20) NOT NULL, for selecting, I’m using: SELECT date_day, SUM(number_of_links) FROM my_table GROUP BY date_day DESC LIMIT 30 I’m getting total number of links per day […]

Update SQL Server database from datagridview

I need to update my database on a local PC with SqlDataAdapter. The project is Windows Forms. This method selects information from database and returns a DataTable to be used as data source for a DataGridView : static string querySelect = “select * from [customers_Sizes] where ID_customers = @ID_customers”; private DataSet recivedData; static public SqlDataAdapter […]

How to check the last time a database table updated

In Sql Server,there is a table called ‘Product’ Is there any way to check the recent time/last time ,when data was populated in ‘Product’ table

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.