Tag: database

How to exclude database objects that include a certain Extended Property using SQL Compare 12?

I’m using SQL Compare to generate a script file to deploy to a production environment, but I can’t get the Include or Exclude command line options to work with extended properties. Here is the commands I’ve tried so far. Let me try to only include only objects with the extended property ‘Feature’ SQLCompare.exe /scripts1:.\ /empty2 […]

SQL – Calling scripts Error SQLCMD query

So i have been writing a data migration script for the past few weeks and have decided it has become too long and is too hard to edit as one long script. So what i wanted to do was to split it up into individual scripts and have one script run the others. From looking […]

How do I save date and time and then sort them from new to old in datagridview, I'm using Visual Studio 2015 and SQL server

In Visual Studio I have: ‘Label15.Text = DateTime.Now.ToString(“dd/M/yyyy(dddd) hh:mm:ss:tt”) Private Sub Timer1_Tick(sender As Object, e As EventArgs) Handles Timer1.Tick Label15.Text = DateTime.Now.ToString(“dd/M/yyyy(dddd) hh:mm:ss:tt”) Label16.Text = DateTime.Now.ToString(” hh:mm:ss tt “) End Sub In sql server currently I’m using a nvarchar data type, what data type should I use? what im trying to do is make a […]

Save data in child table with parent table having composite keys

I wonder why it is not working. I am using ASP.NET MVC having dbcontext to contact with database. I have two tables. Table A and Table B Table A has multiple columns from that there are three columns i.e. Email, Year and Month which are primary keys / composite keys. Table B has a 5 […]

Update/Set multiple column with set and select statement

I have below trigger written which works perfectly fine for single column update (firstname), however we now need to update few extra columns (lastname, mobileNumber etc.) CREATE TRIGGER apl.updateJaWithCandidateDataAfterInsert ON [APL].[tblJobApplications_v2] AFTER INSERT AS SET NOCOUNT ON UPDATE [APL].[tblJobApplications_v2] SET FirstName = ( SELECT FirstName FROM [USR].[tblUserDetails] WHERE inserted.CandidateId = [USR].[tblUserDetails].CandidateId ) FROM [APL].[tblJobApplications_v2] INNER […]

Selected Item – listbox insert to database

I have a small problem associated with adding values ​​to database. C# and SQL Server I have this procedure: ALTER PROCEDURE [AB].[AddMovie] @Actors nvarchar(255), @Director nvarchar(100), @Title nvarchar(255), @Year char(4), @Length nvarchar(5), @Description nvarchar(255), AS BEGIN INSERT INTO AB.Movie (Title, Year, Lenght, Description, Actors, Director) VALUES (@Title, @Year, @Lenght, @Description, @Actors, @Director) END; ADDCATEGORY_TYPE ALTER […]

How to create type from existing table in SQL Server?

I have database with many tables already existing. I need to write stored procedure that takes data identical to some of these tables and process it in stored procedure. I know one can create tables from type. However sometime it’s cumbersome to add new type just to facilitate single stored procedure. Is there any way […]

(Laravel) Join 3 or more tables using “Eloquent Relationships”

I’m trying to join 3 tables using eloquent relationships, but it doesn’t give the expected results. Shipment model class Shipment extends Model { protected $table = ‘ccctadm.Shipment’; public function customergroupcode() { return $this->hasMany(DocumentRuleSet::class,’customergroupcode’,’customergroupcode’); } public function shipmentcategory() { return $this->hasMany(DocumentRuleSet::class,’shipmentcategory’,’shipmentcategory’); } public function status() { return $this->hasMany(DocumentRuleSet::class,’status’,’status’); } } to get the data i’m using […]

Automated task using pymssql runs fine during the day- but not at night; why?

I have a web scraping job that needs to be executed each evening. Our company has a virtual machine with the “Windows Task Manager” application installed. So, I created a new task (i.e., an entry in task manager) to run every evening at 3 a.m. Initially, the process did exactly as expected: it fetched the […]

Composite or Unique Primary Key repititons

So i am working on creating a db, whereby i have the option of tableA or tableB. Please note that in the current concept InstanceID, slabID, and ChangeID are repeated in almost every table because only when combined with a table specific NO or key, can they uniquely identify each row. My concern is whether […]

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