0
So quiet people? I’m beginner with SQL SERVER and I’m in a situation where I don’t know how to proceed anymore. I have 2 banks on a server here at the company, and I need to replicate some data that is in one table to another. However I need to treat a UNIQUEIDENTIFIER for INT but I have no idea how to do this, apparently it is something easy but I could not find anything about it. Follow the query I made below:
INSERT INTO [ITControl].[dbo].[Server] (Name, IP, Description, IdPlant, IdServerType)
SELECT [IPServidor], [NomeServidor], [DescricaoServidor], [IdAmbiente], [IdTipoServidor]
FROM [BAC].[dbo].[Servidor]
WHERE [IdAmbiente] = 'FDE2C706-A103-441A-AB43-1D62517B392E' AND [IdTipoServidor] = '96F5D942-3283-4542-8D78-A4A3D8A3D208'
The problem itself is that in my bank BAC, on the table Servidor my data from the fields [IdAmbiente] and [IdTipoServidor] are of the type UNIQUEIDENTIFIER. Already in my other bank called ITControl on the table Server the fields that would receive this data are of the type INT, my doubt is how I make to pass a INT in place of UNIQUEIDENTIFIER? I wanted to pass the value 7 to the [IdAmbiente] and value 1 for the [IdTipoServidor]
If you repair the ID is a GUID in this case, so it will not work to pass the GUID value to an INT. To solve I advise you to create a table (ID_NOVO, ID_ANTIGO). So you can connect the old id to an id of type INT
– Claudio Lopes
This is called incompatible data, it’s not like I see it as doing this, all they said is gambiarra, why not pass the same type to the other bank? (wrong modeling, almost sure, bank gambiarra, almost other certainty)
– novic
People here from the company helped me, I’m still intern kkk by what it seems I didn’t know very well what I was doing. I’ll post the resolution
– Bruno Taletti