{"id":23819219,"url":"https://github.com/phamdinhkhanh/sqlcode","last_synced_at":"2026-02-28T15:31:37.898Z","repository":{"id":59655510,"uuid":"420884605","full_name":"phamdinhkhanh/SQLCode","owner":"phamdinhkhanh","description":null,"archived":false,"fork":false,"pushed_at":"2021-10-25T06:03:13.000Z","size":257,"stargazers_count":155,"open_issues_count":0,"forks_count":61,"subscribers_count":5,"default_branch":"main","last_synced_at":"2025-02-21T22:29:24.169Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"TSQL","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/phamdinhkhanh.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-25T05:03:00.000Z","updated_at":"2024-12-05T08:40:08.000Z","dependencies_parsed_at":"2022-09-19T13:40:43.257Z","dependency_job_id":null,"html_url":"https://github.com/phamdinhkhanh/SQLCode","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/phamdinhkhanh/SQLCode","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamdinhkhanh%2FSQLCode","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamdinhkhanh%2FSQLCode/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamdinhkhanh%2FSQLCode/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamdinhkhanh%2FSQLCode/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/phamdinhkhanh","download_url":"https://codeload.github.com/phamdinhkhanh/SQLCode/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/phamdinhkhanh%2FSQLCode/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29940284,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-28T13:49:17.081Z","status":"ssl_error","status_checked_at":"2026-02-28T13:48:50.396Z","response_time":90,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2025-01-02T06:38:53.065Z","updated_at":"2026-02-28T15:31:37.860Z","avatar_url":"https://github.com/phamdinhkhanh.png","language":"TSQL","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SQLCode\n\n## Function\n\n* [FunctionConvertDateCrossApply](FunctionConvertDateCrossApply.sql): Convert VARCHAR Date type `DD/MM/YYYY` and return to `YYYY-MM-DD`\n* [FunctionReturnDateInMonth](FunctionReturnDateInMonth.sql): Return number of date in month. Input VARCHAR Date type `YYYYMMDD`\n* [FunctionReturnTable](FunctionReturnTable.sql): Example function about how to return a table by SQL query command.\n* [FunctionReturnTableSegment](FunctionReturnTableSegment.sql): Function create segmentation for customer base on income.\n* [FunctionReturnVariable](FunctionReturnVariable.sql): Example function about returning a variable.\n* [FunctionReturnWeek](FunctionReturnWeek.sql): Return week in year.\n\n## Procedure\n\n* [ProcedureImportCSVFile](ProcedureImportCSVFile.sql): Procedure to import CSV.\n* [ProcedureImportTextFile](ProcedureImportTextFile.sql): Procedure to import txt file.\n* [ProcedureSelectWorkOrder](ProcedureSelectWorkOrder.sql): Procedure of SELECT query.\n* [ExecRcodeFromSQL](ExecRcodeFromSQL.sql): Run R code inside SQL.\n\n## Useful Example\n\n* [ImportFromOpenRowSet](ImportFromOpenRowSet.sql): How to use `OPENROWSET` command to load excel file into data base.\n* [Index](Index.sql): How to create index for table\n* [backup](backup.sql): Backup database.\n* [AttachDatabase](AttachDatabase.sql): Attach database.\n* [Pivotable](Pivotable.sql): How to create a pivotable in SQL.\n* [PartitionTable](PartitionTable.sql): Partition table according time in SQL.\n* [SwitchOutDataByPartition](SwitchOutDataByPartition.sql): Switch out data by partition group.\n* [Inline\u0026MultipleStatementFunction](Inline\u0026MultipleStatementFunction.sql): Example about Multi-Statement Function.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphamdinhkhanh%2Fsqlcode","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fphamdinhkhanh%2Fsqlcode","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fphamdinhkhanh%2Fsqlcode/lists"}