This commit is contained in:
2025-07-14 08:07:24 -04:00
parent fd17ec5be5
commit 0f3009a517
16 changed files with 134 additions and 82 deletions
+1 -1
View File
@@ -360,4 +360,4 @@ MigrationBackup/
.ionide/ .ionide/
# Fody - auto-generated XML schema # Fody - auto-generated XML schema
FodyWeavers.xsd FodyWeavers.xsd
Binary file not shown.
@@ -1,19 +1,7 @@
{ {
"Version": 1, "Version": 1,
"WorkspaceRootPath": "C:\\Repos\\SqlCustomFunctions\\", "WorkspaceRootPath": "C:\\Repos\\SqlCustomFunctions\\",
"Documents": [ "Documents": [],
{
"AbsoluteMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|C:\\Repos\\SqlCustomFunctions\\IPFunctions.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|solutionrelative:IPFunctions.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{00000000-0000-0000-0000-000000000000}|\u003CSolution\u003E|SqlCustomFunctions||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|"
},
{
"AbsoluteMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|C:\\Repos\\SqlCustomFunctions\\SqlCustomFunctions.sqlproj||{B270807C-D8C6-49EB-8EBE-8E8D566637A1}|008b9af8-091d-4ba5-95e1-5f3479df8fcc",
"RelativeMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|solutionrelative:SqlCustomFunctions.sqlproj||{B270807C-D8C6-49EB-8EBE-8E8D566637A1}|008b9af8-091d-4ba5-95e1-5f3479df8fcc"
}
],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
{ {
"Orientation": 0, "Orientation": 0,
@@ -21,7 +9,7 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 12, "SelectedChildIndex": -1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
@@ -66,31 +54,6 @@
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "SqlCustomFunctions",
"DocumentMoniker": "C:\\Repos\\SqlCustomFunctions\\SqlCustomFunctions.sqlproj",
"RelativeDocumentMoniker": "SqlCustomFunctions.sqlproj",
"ToolTip": "C:\\Repos\\SqlCustomFunctions\\SqlCustomFunctions.sqlproj",
"RelativeToolTip": "SqlCustomFunctions.sqlproj",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
"WhenOpened": "2025-07-11T10:34:59.027Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "IPFunctions.cs",
"DocumentMoniker": "C:\\Repos\\SqlCustomFunctions\\IPFunctions.cs",
"RelativeDocumentMoniker": "IPFunctions.cs",
"ToolTip": "C:\\Repos\\SqlCustomFunctions\\IPFunctions.cs",
"RelativeToolTip": "IPFunctions.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAhAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-07-10T13:15:33.845Z",
"EditorCaption": ""
} }
] ]
} }
+2 -39
View File
@@ -1,19 +1,7 @@
{ {
"Version": 1, "Version": 1,
"WorkspaceRootPath": "C:\\Repos\\SqlCustomFunctions\\", "WorkspaceRootPath": "C:\\Repos\\SqlCustomFunctions\\",
"Documents": [ "Documents": [],
{
"AbsoluteMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|C:\\Repos\\SqlCustomFunctions\\IPFunctions.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}",
"RelativeMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|solutionrelative:IPFunctions.cs||{A6C744A8-0E4A-4FC6-886A-064283054674}"
},
{
"AbsoluteMoniker": "D:0:0:{00000000-0000-0000-0000-000000000000}|\u003CSolution\u003E|SqlCustomFunctions||{04B8AB82-A572-4FEF-95CE-5222444B6B64}|"
},
{
"AbsoluteMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|C:\\Repos\\SqlCustomFunctions\\SqlCustomFunctions.sqlproj||{B270807C-D8C6-49EB-8EBE-8E8D566637A1}|008b9af8-091d-4ba5-95e1-5f3479df8fcc",
"RelativeMoniker": "D:0:0:{1CE29CD9-8ED4-497C-A794-85FA3BA3B87F}|SqlCustomFunctions.sqlproj|solutionrelative:SqlCustomFunctions.sqlproj||{B270807C-D8C6-49EB-8EBE-8E8D566637A1}|008b9af8-091d-4ba5-95e1-5f3479df8fcc"
}
],
"DocumentGroupContainers": [ "DocumentGroupContainers": [
{ {
"Orientation": 0, "Orientation": 0,
@@ -21,7 +9,7 @@
"DocumentGroups": [ "DocumentGroups": [
{ {
"DockedWidth": 200, "DockedWidth": 200,
"SelectedChildIndex": 12, "SelectedChildIndex": -1,
"Children": [ "Children": [
{ {
"$type": "Bookmark", "$type": "Bookmark",
@@ -66,31 +54,6 @@
{ {
"$type": "Bookmark", "$type": "Bookmark",
"Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}" "Name": "ST:0:0:{aa2115a1-9712-457b-9047-dbb71ca2cdd2}"
},
{
"$type": "Document",
"DocumentIndex": 1,
"Title": "SqlCustomFunctions",
"DocumentMoniker": "C:\\Repos\\SqlCustomFunctions\\SqlCustomFunctions.sqlproj",
"RelativeDocumentMoniker": "SqlCustomFunctions.sqlproj",
"ToolTip": "C:\\Repos\\SqlCustomFunctions\\SqlCustomFunctions.sqlproj",
"RelativeToolTip": "SqlCustomFunctions.sqlproj",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.001001|",
"WhenOpened": "2025-07-11T10:34:59.027Z",
"EditorCaption": ""
},
{
"$type": "Document",
"DocumentIndex": 0,
"Title": "IPFunctions.cs",
"DocumentMoniker": "C:\\Repos\\SqlCustomFunctions\\IPFunctions.cs",
"RelativeDocumentMoniker": "IPFunctions.cs",
"ToolTip": "C:\\Repos\\SqlCustomFunctions\\IPFunctions.cs",
"RelativeToolTip": "IPFunctions.cs",
"ViewState": "AgIAAAAAAAAAAAAAAAAAAAwAAAAhAAAAAAAAAA==",
"Icon": "ae27a6b0-e345-4288-96df-5eaf394ee369.000738|",
"WhenOpened": "2025-07-10T13:15:33.845Z",
"EditorCaption": ""
} }
] ]
} }
+95
View File
@@ -0,0 +1,95 @@
using System;
using System.Collections.Generic;
using System.Text;
using System.Data.SqlTypes;
using System.Security.Cryptography;
using Microsoft.VisualBasic;
namespace SqlCustomFunctions
{
public static class ClsConversions
{
[Microsoft.SqlServer.Server.SqlFunction()]
static public SqlGuid StringToGUID(SqlString theInputString)
{
SqlGuid gx = Guid.Empty;
string myString = theInputString.Value.ToString();
using (MD5 hasher = MD5.Create())
{
var dbytes = hasher.ComputeHash(Encoding.UTF8.GetBytes(myString));
var sBuilder = new StringBuilder();
for (int n = 0; n < dbytes.Length; n++)
sBuilder.Append(dbytes[n].ToString("X2"));
gx = Guid.Parse(sBuilder.ToString());
}
return gx;
}
[Microsoft.SqlServer.Server.SqlFunction()]
static public SqlString FormatPhone(SqlInt64 Num)
{
SqlString rv = string.Empty;
if (Num.Value.ToString().Trim().Length != 10)
rv = Num.Value.ToString();
else
rv = string.Format("{0:(000) 000-0000}", Num.Value);
return rv;
}
[Microsoft.SqlServer.Server.SqlFunction()]
static public SqlDateTime dtFirstDayOfMonth(SqlDateTime InDate)
{
SqlDateTime rv = DateSerial(InDate.Value.Year, Convert.ToInt16(InDate.Value.Month), 1);
return rv;
}
[Microsoft.SqlServer.Server.SqlFunction()]
static public SqlDateTime dtLastDayOfMonth(SqlDateTime InDate)
{
SqlDateTime rv = DateSerial(InDate.Value.Year, Convert.ToInt16(InDate.Value.Month + 1), 0);
return rv;
}
public static SqlDateTime dtSerial(int year, short month, short day)
{
if (year < 0)
{
year = DateTime.Now.Year + year;
}
else if (year < 100)
{
year = 1930 + year;
}
DateTime dt = new DateTime(year, 1, 1);
dt = dt.AddMonths(month - 1);
dt = dt.AddDays(day - 1);
return dt;
}
private static DateTime DateSerial(int year, short month, short day)
{
if (year < 0)
{
year = DateTime.Now.Year + year;
}
else if (year < 100)
{
year = 1930 + year;
}
DateTime dt = new DateTime(year, 1, 1);
dt = dt.AddMonths(month - 1);
dt = dt.AddDays(day - 1);
return dt;
}
}
}
+3
View File
@@ -63,6 +63,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="IPFunctions.cs" /> <Compile Include="IPFunctions.cs" />
<Compile Include="ClsConversions.cs" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Reference Include="System.Data" /> <Reference Include="System.Data" />
@@ -73,5 +74,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<None Include="SqlCustomFunctions.publish.xml" /> <None Include="SqlCustomFunctions.publish.xml" />
<None Include=".gitattributes" />
<None Include=".gitignore" />
</ItemGroup> </ItemGroup>
</Project> </Project>
Binary file not shown.
Binary file not shown.
Binary file not shown.
File diff suppressed because one or more lines are too long
Binary file not shown.
Binary file not shown.
@@ -1 +1 @@
d8d0182c3dbee7bd86960fb812bf538030753b6ec76b2ab714ddfb99ba744d8a 25434979ee893bc83c688b6cfe1291ab64a0283ccf6e5080ecb880a21f22727f
@@ -5,3 +5,7 @@ C:\Repos\SqlCustomFunctions\obj\Release\SqlCustomFunctions.dll
C:\Repos\SqlCustomFunctions\obj\Release\SqlCustomFunctions.pdb C:\Repos\SqlCustomFunctions\obj\Release\SqlCustomFunctions.pdb
C:\Repos\SqlCustomFunctions\bin\Release\SqlCustomFunctions.dll C:\Repos\SqlCustomFunctions\bin\Release\SqlCustomFunctions.dll
C:\Repos\SqlCustomFunctions\bin\Release\SqlCustomFunctions.pdb C:\Repos\SqlCustomFunctions\bin\Release\SqlCustomFunctions.pdb
C:\Repos\SqlCustomFunctions\obj\Release\Model.xml
C:\Repos\SqlCustomFunctions\obj\Release\refactor.xml
C:\Repos\SqlCustomFunctions\obj\Release\postdeploy.sql
C:\Repos\SqlCustomFunctions\obj\Release\predeploy.sql